mirror of
https://gitee.com/san-bing/JChargePointProtocol
synced 2026-05-05 02:19:56 +08:00
配置手册
This commit is contained in:
@@ -176,17 +176,17 @@ service:
|
|||||||
sessions:
|
sessions:
|
||||||
default-inactivity-timeout-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_INACTIVITY_TIMEOUT_IN_SEC:600}"
|
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}"
|
default-state-check-interval-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_STATE_CHECK_INTERVAL_IN_SEC:60}"
|
||||||
rpc:
|
grpc:
|
||||||
port: "${SERVICE_PROTOCOL_RPC_PORT:9090}"
|
port: "${SERVICE_PROTOCOL_GRPC_PORT:9090}"
|
||||||
boss: "${SERVICE_PROTOCOL_RPC_BOSS:4}"
|
boss: "${SERVICE_PROTOCOL_GRPC_BOSS:4}"
|
||||||
worker: "${SERVICE_PROTOCOL_RPC_WORKER:64}"
|
worker: "${SERVICE_PROTOCOL_GRPC_WORKER:64}"
|
||||||
so-rcvbuf: "${SERVICE_PROTOCOL_RPC_SO_RCVBUF:65535}"
|
so-rcvbuf: "${SERVICE_PROTOCOL_GRPC_SO_RCVBUF:65535}"
|
||||||
so-sndbuf: "${SERVICE_PROTOCOL_RPC_SO_SNDBUF:65535}"
|
so-sndbuf: "${SERVICE_PROTOCOL_GRPC_SO_SNDBUF:65535}"
|
||||||
no-delay: "${SERVICE_PROTOCOL_RPC_NO_DELAY:true}"
|
no-delay: "${SERVICE_PROTOCOL_GRPC_NO_DELAY:true}"
|
||||||
user-thread-pool-size: "${SERVICE_PROTOCOL_RPC_USER_THREAD_POOL_SIZE:1024}"
|
user-thread-pool-size: "${SERVICE_PROTOCOL_GRPC_USER_THREAD_POOL_SIZE:1024}"
|
||||||
max-inbound-message-size: "${SERVICE_PROTOCOL_RPC_MAX_INBOUND_MESSAGE_SIZE:33554432}"
|
max-inbound-message-size: "${SERVICE_PROTOCOL_GRPC_MAX_INBOUND_MESSAGE_SIZE:33554432}"
|
||||||
max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}"
|
max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_GRPC_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}"
|
||||||
client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_RPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}"
|
client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_GRPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}"
|
||||||
protocols:
|
protocols:
|
||||||
yunkuaichongV150:
|
yunkuaichongV150:
|
||||||
enabled: "${PROTOCOLS_YUNKUAICHONGV150_ENABLED:true}"
|
enabled: "${PROTOCOLS_YUNKUAICHONGV150_ENABLED:true}"
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ import static sanbing.jcpp.infrastructure.proto.ProtoConverter.toTracerProto;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class DownlinkGrpcClient {
|
public class DownlinkGrpcClient {
|
||||||
|
|
||||||
@Value("${downlink.rpc.grpc.netty.event_loop:}")
|
@Value("${service.downlink.rpc.grpc.netty.event_loop:}")
|
||||||
private Integer rpcNettyEventLoop;
|
private Integer rpcNettyEventLoop;
|
||||||
|
|
||||||
@Value("${downlink.rpc.grpc.netty.so_sndbuf:65535}")
|
@Value("${service.downlink.rpc.grpc.netty.so_sndbuf:65535}")
|
||||||
private Integer rpcNettySoSndbuf;
|
private Integer rpcNettySoSndbuf;
|
||||||
|
|
||||||
@Value("${service.downlink.rpc.grpc.netty.so_rcvbuf:65535}")
|
@Value("${service.downlink.rpc.grpc.netty.so_rcvbuf:65535}")
|
||||||
|
|||||||
@@ -41,23 +41,23 @@ import static sanbing.jcpp.infrastructure.util.config.ThreadPoolConfiguration.JC
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@ConditionalOnExpression("'${service.type:null}'=='monolith' || '${service.type:null}'=='protocol'")
|
@ConditionalOnExpression("'${service.type:null}'=='monolith' || '${service.type:null}'=='protocol'")
|
||||||
public class DownlinkGrpcService extends ProtocolInterfaceImplBase {
|
public class DownlinkGrpcService extends ProtocolInterfaceImplBase {
|
||||||
@Value("${service.protocol.rpc.port}")
|
@Value("${service.protocol.grpc.port}")
|
||||||
private int rpcPort;
|
private int grpcPort;
|
||||||
@Value("${service.protocol.rpc.boss}")
|
@Value("${service.protocol.grpc.boss}")
|
||||||
private int rpcBoss;
|
private int grpcBoss;
|
||||||
@Value("${service.protocol.rpc.worker}")
|
@Value("${service.protocol.grpc.worker}")
|
||||||
private int rpcWorker;
|
private int grpcWorker;
|
||||||
@Value("${service.protocol.rpc.so-rcvbuf}")
|
@Value("${service.protocol.grpc.so-rcvbuf}")
|
||||||
private int rpcNettySoRcvbuf;
|
private int grpcNettySoRcvbuf;
|
||||||
@Value("${service.protocol.rpc.so-sndbuf}")
|
@Value("${service.protocol.grpc.so-sndbuf}")
|
||||||
private int rpcNettySoSndbuf;
|
private int grpcNettySoSndbuf;
|
||||||
@Value("${service.protocol.rpc.no-delay}")
|
@Value("${service.protocol.grpc.no-delay}")
|
||||||
private boolean rpcNettyNoDelay;
|
private boolean grpcNettyNoDelay;
|
||||||
@Value("${service.protocol.rpc.max-inbound-message-size}")
|
@Value("${service.protocol.grpc.max-inbound-message-size}")
|
||||||
private int maxInboundMessageSize;
|
private int maxInboundMessageSize;
|
||||||
@Value("${service.protocol.rpc.max-concurrent-calls-per-connection}")
|
@Value("${service.protocol.grpc.max-concurrent-calls-per-connection}")
|
||||||
private int maxConcurrentCallsPerConnection;
|
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;
|
private int clientMaxKeepAliveTimeSec;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -70,12 +70,12 @@ public class DownlinkGrpcService extends ProtocolInterfaceImplBase {
|
|||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
log.info("Initializing Protocol Downlink Grpc service!");
|
log.info("Initializing Protocol Downlink Grpc service!");
|
||||||
|
|
||||||
NettyServerBuilder builder = NettyServerBuilder.forPort(this.rpcPort)
|
NettyServerBuilder builder = NettyServerBuilder.forPort(this.grpcPort)
|
||||||
.bossEventLoopGroup(new NioEventLoopGroup(this.rpcBoss))
|
.bossEventLoopGroup(new NioEventLoopGroup(this.grpcBoss))
|
||||||
.workerEventLoopGroup(new NioEventLoopGroup(this.rpcWorker))
|
.workerEventLoopGroup(new NioEventLoopGroup(this.grpcWorker))
|
||||||
.withOption(ChannelOption.SO_RCVBUF, rpcNettySoRcvbuf)
|
.withOption(ChannelOption.SO_RCVBUF, grpcNettySoRcvbuf)
|
||||||
.withChildOption(ChannelOption.SO_SNDBUF, rpcNettySoSndbuf)
|
.withChildOption(ChannelOption.SO_SNDBUF, grpcNettySoSndbuf)
|
||||||
.withChildOption(ChannelOption.TCP_NODELAY, rpcNettyNoDelay)
|
.withChildOption(ChannelOption.TCP_NODELAY, grpcNettyNoDelay)
|
||||||
.compressorRegistry(CompressorRegistry.getDefaultInstance())
|
.compressorRegistry(CompressorRegistry.getDefaultInstance())
|
||||||
.decompressorRegistry(DecompressorRegistry.getDefaultInstance())
|
.decompressorRegistry(DecompressorRegistry.getDefaultInstance())
|
||||||
.channelType(NioServerSocketChannel.class)
|
.channelType(NioServerSocketChannel.class)
|
||||||
@@ -89,7 +89,7 @@ public class DownlinkGrpcService extends ProtocolInterfaceImplBase {
|
|||||||
.addService(this);
|
.addService(this);
|
||||||
|
|
||||||
this.server = builder.build();
|
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 {
|
try {
|
||||||
this.server.start();
|
this.server.start();
|
||||||
|
|||||||
@@ -49,17 +49,17 @@ service:
|
|||||||
sessions:
|
sessions:
|
||||||
default-inactivity-timeout-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_INACTIVITY_TIMEOUT_IN_SEC:600}"
|
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}"
|
default-state-check-interval-in-sec: "${SERVICE_PROTOCOLS_SESSIONS_DEFAULT_STATE_CHECK_INTERVAL_IN_SEC:60}"
|
||||||
rpc:
|
grpc:
|
||||||
port: "${SERVICE_PROTOCOL_RPC_PORT:9090}"
|
port: "${SERVICE_PROTOCOL_GRPC_PORT:9090}"
|
||||||
boss: "${SERVICE_PROTOCOL_RPC_BOSS:4}"
|
boss: "${SERVICE_PROTOCOL_GRPC_BOSS:4}"
|
||||||
worker: "${SERVICE_PROTOCOL_RPC_WORKER:64}"
|
worker: "${SERVICE_PROTOCOL_GRPC_WORKER:64}"
|
||||||
so-rcvbuf: "${SERVICE_PROTOCOL_RPC_SO_RCVBUF:65535}"
|
so-rcvbuf: "${SERVICE_PROTOCOL_GRPC_SO_RCVBUF:65535}"
|
||||||
so-sndbuf: "${SERVICE_PROTOCOL_RPC_SO_SNDBUF:65535}"
|
so-sndbuf: "${SERVICE_PROTOCOL_GRPC_SO_SNDBUF:65535}"
|
||||||
no-delay: "${SERVICE_PROTOCOL_RPC_NO_DELAY:true}"
|
no-delay: "${SERVICE_PROTOCOL_GRPC_NO_DELAY:true}"
|
||||||
user-thread-pool-size: "${SERVICE_PROTOCOL_RPC_USER_THREAD_POOL_SIZE:1024}"
|
user-thread-pool-size: "${SERVICE_PROTOCOL_GRPC_USER_THREAD_POOL_SIZE:1024}"
|
||||||
max-inbound-message-size: "${SERVICE_PROTOCOL_RPC_MAX_INBOUND_MESSAGE_SIZE:33554432}"
|
max-inbound-message-size: "${SERVICE_PROTOCOL_GRPC_MAX_INBOUND_MESSAGE_SIZE:33554432}"
|
||||||
max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}"
|
max-concurrent-calls-per-connection: "${SERVICE_PROTOCOL_GRPC_MAX_CONCURRENT_CALLS_PER_CONNECTION:4}"
|
||||||
client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_RPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}"
|
client-max-keep-alive-time-sec: "${SERVICE_PROTOCOL_GRPC_CLIENT_MAX_KEEP_ALIVE_TIME_SEC:30}"
|
||||||
protocols:
|
protocols:
|
||||||
yunkuaichongV150:
|
yunkuaichongV150:
|
||||||
enabled: "${PROTOCOLS_YUNKUAICHONGV150_ENABLED:true}"
|
enabled: "${PROTOCOLS_YUNKUAICHONGV150_ENABLED:true}"
|
||||||
|
|||||||
Reference in New Issue
Block a user