Merge remote-tracking branch 'refs/remotes/public/master' into feature/YunKuaiChongV160

# Conflicts:
#	jcpp-app-bootstrap/src/test/resources/app-service-test.properties
This commit is contained in:
三丙
2024-10-15 09:50:01 +08:00
10 changed files with 80 additions and 27 deletions

View File

@@ -71,7 +71,7 @@ service:
topic: "${PROTOCOLS_YUNKUAICHONGV150_FORWARD_KAFKA_TOPIC:protocol_uplink}"
jcpp-partition: "${PROTOCOLS_YUNKUAICHONGV150_FORWARD_KAFKA_JCPP_PARTITION:true}" # 是否利用JCPP的分片框架
# 以下配置只有在service.type为protocol时且jcpp-partition为false时才生效
bootstrap-servers: "${PROTOCOLS_YUNKUAICHONGV150_FORWARD_KAFKA_SERVERS:10.102.12.102:9092}"
bootstrap-servers: "${PROTOCOLS_YUNKUAICHONGV150_FORWARD_KAFKA_SERVERS:kafka:9092}"
acks: "${PROTOCOLS_YUNKUAICHONGV150_FORWARD_KAFKA_ACKS:1}"
# # 可选 protobuf推荐、json
encoder: "${PROTOCOLS_YUNKUAICHONGV150_FORWARD_KAFKA_ENCODER:protobuf}"
@@ -121,7 +121,7 @@ service:
# 应用程序服务注册中心配置
zk:
enabled: "${ZOOKEEPER_ENABLED:true}"
enabled: "${ZOOKEEPER_ENABLED:false}"
url: "${ZOOKEEPER_URL:zookeeper:2181}"
retry-interval-ms: "${ZOOKEEPER_RETRY_INTERVAL_MS:3000}"
connection-timeout-ms: "${ZOOKEEPER_CONNECTION_TIMEOUT_MS:3000}"

View File

@@ -66,7 +66,6 @@ class DownlinkControllerIT extends AbstractProtocolTestBase {
binaryHandlerConfig.getLengthFieldOffset(), binaryHandlerConfig.getLengthFieldLength(),
binaryHandlerConfig.getLengthAdjustment(), binaryHandlerConfig.getInitialBytesToStrip());
group = new NioEventLoopGroup();
Bootstrap b = new Bootstrap();
b.group(group)
@@ -80,7 +79,6 @@ class DownlinkControllerIT extends AbstractProtocolTestBase {
.addLast(new SimpleChannelInboundHandler<>() {
@Override
protected void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
log.info("接收到下行报文:{}", msg);
}
});
@@ -105,14 +103,19 @@ class DownlinkControllerIT extends AbstractProtocolTestBase {
// 先发送一段登录
channel.writeAndFlush(Unpooled.wrappedBuffer(HexUtil.decodeHex("6822001900012023121200001001011047562e393572313300898604d11722d0348606024E87"))).sync();
// 停一会等注册完成 todo 也可以读下行消息判断是否登录成功
Thread.sleep(1000);
// 一直检查等待会话注册完成
UUID sessionId;
while (true) {
if (sessionRegistryProvider.getSessionCache().asMap().values().stream().findFirst().isPresent()) {
ProtocolSession protocolSession = sessionRegistryProvider.getSessionCache().asMap().values().stream().findFirst().get();
sessionId = protocolSession.getId();
break;
}
Thread.sleep(100);
}
UUID messageId = UUID.randomUUID();
ProtocolSession protocolSession = sessionRegistryProvider.getSessionCache().asMap().values().stream().findFirst().get();
UUID sessionId = protocolSession.getId();
UUID requestId = UUID.randomUUID();
// 创建 DownlinkRestMessage 实例
String pileCode = "20231212000010";
DownlinkRestMessage downlinkMsg = DownlinkRestMessage.newBuilder()