diff --git a/jcpp-app-bootstrap/src/main/resources/app-service.yml b/jcpp-app-bootstrap/src/main/resources/app-service.yml index 0062f58..a9b737b 100644 --- a/jcpp-app-bootstrap/src/main/resources/app-service.yml +++ b/jcpp-app-bootstrap/src/main/resources/app-service.yml @@ -176,17 +176,17 @@ service: sessions: default-inactivity-timeout-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_INACTIVITY_TIMEOUT_IN_SEC:600}" default-state-check-interval-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_STATE_CHECK_INTERVAL_IN_SEC:60}" - rpc: - port: "${SERVICE_PROTOCOL_RPC_PORT:9090}" - boss: "${SERVICE_PROTOCOL_RPC_BOSS:4}" - worker: "${SERVICE_PROTOCOL_RPC_WORKER:64}" - so-rcvbuf: "${SERVICE_PROTOCOL_RPC_SO_RCVBUF:65535}" - so-sndbuf: "${SERVICE_PROTOCOL_RPC_SO_SNDBUF:65535}" - no-delay: "${SERVICE_PROTOCOL_RPC_NO_DELAY:true}" - user-thread-pool-size: "${SERVICE_PROTOCOL_RPC_USER_THREAD_POOL_SIZE:1024}" - max-inbound-message-size: "${SERVICE_PROTOCOL_RPC_MAX_INBOUND_MESSAGE_SIZE:33554432}" - max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}" - client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_RPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}" + grpc: + port: "${SERVICE_PROTOCOL_GRPC_PORT:9090}" + boss: "${SERVICE_PROTOCOL_GRPC_BOSS:4}" + worker: "${SERVICE_PROTOCOL_GRPC_WORKER:64}" + so-rcvbuf: "${SERVICE_PROTOCOL_GRPC_SO_RCVBUF:65535}" + so-sndbuf: "${SERVICE_PROTOCOL_GRPC_SO_SNDBUF:65535}" + no-delay: "${SERVICE_PROTOCOL_GRPC_NO_DELAY:true}" + user-thread-pool-size: "${SERVICE_PROTOCOL_GRPC_USER_THREAD_POOL_SIZE:1024}" + max-inbound-message-size: "${SERVICE_PROTOCOL_GRPC_MAX_INBOUND_MESSAGE_SIZE:33554432}" + max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_GRPC_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}" + client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_GRPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}" protocols: yunkuaichongV150: enabled: "${PROTOCOLS_YUNKUAICHONGV150_ENABLED:true}" diff --git a/jcpp-app/src/main/java/sanbing/jcpp/app/service/grpc/DownlinkGrpcClient.java b/jcpp-app/src/main/java/sanbing/jcpp/app/service/grpc/DownlinkGrpcClient.java index 641e789..2fe52bf 100644 --- a/jcpp-app/src/main/java/sanbing/jcpp/app/service/grpc/DownlinkGrpcClient.java +++ b/jcpp-app/src/main/java/sanbing/jcpp/app/service/grpc/DownlinkGrpcClient.java @@ -45,10 +45,10 @@ import static sanbing.jcpp.infrastructure.proto.ProtoConverter.toTracerProto; @Slf4j public class DownlinkGrpcClient { - @Value("${downlink.rpc.grpc.netty.event_loop:}") + @Value("${service.downlink.rpc.grpc.netty.event_loop:}") private Integer rpcNettyEventLoop; - @Value("${downlink.rpc.grpc.netty.so_sndbuf:65535}") + @Value("${service.downlink.rpc.grpc.netty.so_sndbuf:65535}") private Integer rpcNettySoSndbuf; @Value("${service.downlink.rpc.grpc.netty.so_rcvbuf:65535}") diff --git a/jcpp-protocol-api/src/main/java/sanbing/jcpp/protocol/adapter/DownlinkGrpcService.java b/jcpp-protocol-api/src/main/java/sanbing/jcpp/protocol/adapter/DownlinkGrpcService.java index e9a7d0e..a739eb2 100644 --- a/jcpp-protocol-api/src/main/java/sanbing/jcpp/protocol/adapter/DownlinkGrpcService.java +++ b/jcpp-protocol-api/src/main/java/sanbing/jcpp/protocol/adapter/DownlinkGrpcService.java @@ -41,23 +41,23 @@ import static sanbing.jcpp.infrastructure.util.config.ThreadPoolConfiguration.JC @Slf4j @ConditionalOnExpression("'${service.type:null}'=='monolith' || '${service.type:null}'=='protocol'") public class DownlinkGrpcService extends ProtocolInterfaceImplBase { - @Value("${service.protocol.rpc.port}") - private int rpcPort; - @Value("${service.protocol.rpc.boss}") - private int rpcBoss; - @Value("${service.protocol.rpc.worker}") - private int rpcWorker; - @Value("${service.protocol.rpc.so-rcvbuf}") - private int rpcNettySoRcvbuf; - @Value("${service.protocol.rpc.so-sndbuf}") - private int rpcNettySoSndbuf; - @Value("${service.protocol.rpc.no-delay}") - private boolean rpcNettyNoDelay; - @Value("${service.protocol.rpc.max-inbound-message-size}") + @Value("${service.protocol.grpc.port}") + private int grpcPort; + @Value("${service.protocol.grpc.boss}") + private int grpcBoss; + @Value("${service.protocol.grpc.worker}") + private int grpcWorker; + @Value("${service.protocol.grpc.so-rcvbuf}") + private int grpcNettySoRcvbuf; + @Value("${service.protocol.grpc.so-sndbuf}") + private int grpcNettySoSndbuf; + @Value("${service.protocol.grpc.no-delay}") + private boolean grpcNettyNoDelay; + @Value("${service.protocol.grpc.max-inbound-message-size}") private int maxInboundMessageSize; - @Value("${service.protocol.rpc.max-concurrent-calls-per-connection}") + @Value("${service.protocol.grpc.max-concurrent-calls-per-connection}") private int maxConcurrentCallsPerConnection; - @Value("${service.protocol.rpc.client-max-keep-alive-time-sec}") + @Value("${service.protocol.grpc.client-max-keep-alive-time-sec}") private int clientMaxKeepAliveTimeSec; @Resource @@ -70,12 +70,12 @@ public class DownlinkGrpcService extends ProtocolInterfaceImplBase { public void init() throws Exception { log.info("Initializing Protocol Downlink Grpc service!"); - NettyServerBuilder builder = NettyServerBuilder.forPort(this.rpcPort) - .bossEventLoopGroup(new NioEventLoopGroup(this.rpcBoss)) - .workerEventLoopGroup(new NioEventLoopGroup(this.rpcWorker)) - .withOption(ChannelOption.SO_RCVBUF, rpcNettySoRcvbuf) - .withChildOption(ChannelOption.SO_SNDBUF, rpcNettySoSndbuf) - .withChildOption(ChannelOption.TCP_NODELAY, rpcNettyNoDelay) + NettyServerBuilder builder = NettyServerBuilder.forPort(this.grpcPort) + .bossEventLoopGroup(new NioEventLoopGroup(this.grpcBoss)) + .workerEventLoopGroup(new NioEventLoopGroup(this.grpcWorker)) + .withOption(ChannelOption.SO_RCVBUF, grpcNettySoRcvbuf) + .withChildOption(ChannelOption.SO_SNDBUF, grpcNettySoSndbuf) + .withChildOption(ChannelOption.TCP_NODELAY, grpcNettyNoDelay) .compressorRegistry(CompressorRegistry.getDefaultInstance()) .decompressorRegistry(DecompressorRegistry.getDefaultInstance()) .channelType(NioServerSocketChannel.class) @@ -89,7 +89,7 @@ public class DownlinkGrpcService extends ProtocolInterfaceImplBase { .addService(this); this.server = builder.build(); - log.info("Going to start RPC server using port: {}", this.rpcPort); + log.info("Going to start RPC server using port: {}", this.grpcPort); try { this.server.start(); diff --git a/jcpp-protocol-bootstrap/src/main/resources/protocol-service.yml b/jcpp-protocol-bootstrap/src/main/resources/protocol-service.yml index db73c09..da59e95 100644 --- a/jcpp-protocol-bootstrap/src/main/resources/protocol-service.yml +++ b/jcpp-protocol-bootstrap/src/main/resources/protocol-service.yml @@ -49,17 +49,17 @@ service: sessions: default-inactivity-timeout-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_INACTIVITY_TIMEOUT_IN_SEC:600}" default-state-check-interval-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_STATE_CHECK_INTERVAL_IN_SEC:60}" - rpc: - port: "${SERVICE_PROTOCOL_RPC_PORT:9090}" - boss: "${SERVICE_PROTOCOL_RPC_BOSS:4}" - worker: "${SERVICE_PROTOCOL_RPC_WORKER:64}" - so-rcvbuf: "${SERVICE_PROTOCOL_RPC_SO_RCVBUF:65535}" - so-sndbuf: "${SERVICE_PROTOCOL_RPC_SO_SNDBUF:65535}" - no-delay: "${SERVICE_PROTOCOL_RPC_NO_DELAY:true}" - user-thread-pool-size: "${SERVICE_PROTOCOL_RPC_USER_THREAD_POOL_SIZE:1024}" - max-inbound-message-size: "${SERVICE_PROTOCOL_RPC_MAX_INBOUND_MESSAGE_SIZE:33554432}" - max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}" - client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_RPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}" + grpc: + port: "${SERVICE_PROTOCOL_GRPC_PORT:9090}" + boss: "${SERVICE_PROTOCOL_GRPC_BOSS:4}" + worker: "${SERVICE_PROTOCOL_GRPC_WORKER:64}" + so-rcvbuf: "${SERVICE_PROTOCOL_GRPC_SO_RCVBUF:65535}" + so-sndbuf: "${SERVICE_PROTOCOL_GRPC_SO_SNDBUF:65535}" + no-delay: "${SERVICE_PROTOCOL_GRPC_NO_DELAY:true}" + user-thread-pool-size: "${SERVICE_PROTOCOL_GRPC_USER_THREAD_POOL_SIZE:1024}" + max-inbound-message-size: "${SERVICE_PROTOCOL_GRPC_MAX_INBOUND_MESSAGE_SIZE:33554432}" + max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_GRPC_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}" + client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_GRPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}" protocols: yunkuaichongV150: enabled: "${PROTOCOLS_YUNKUAICHONGV150_ENABLED:true}"