发送消息到mq
This commit is contained in:
@@ -46,7 +46,7 @@ public class AgentDecoderHandler extends ChannelInboundHandlerAdapter {
|
|||||||
if (msg instanceof ByteBuf) {
|
if (msg instanceof ByteBuf) {
|
||||||
ByteBuf byteBuf = (ByteBuf) msg;
|
ByteBuf byteBuf = (ByteBuf) msg;
|
||||||
String messages = byteBuf.toString(CharsetUtil.UTF_8); // 指定字符集解码
|
String messages = byteBuf.toString(CharsetUtil.UTF_8); // 指定字符集解码
|
||||||
// AssertLog.info("<<[up1]:IP:{},[up-content]==>{}", sessionManager.client(ctx),messages);
|
AssertLog.info("<<[up1]:IP:{},[up-content]==>{}", sessionManager.client(ctx),messages);
|
||||||
|
|
||||||
String content = "";
|
String content = "";
|
||||||
boolean isClear = false;
|
boolean isClear = false;
|
||||||
@@ -91,7 +91,7 @@ public class AgentDecoderHandler extends ChannelInboundHandlerAdapter {
|
|||||||
content = tempMsg + messages;
|
content = tempMsg + messages;
|
||||||
isClear = true;
|
isClear = true;
|
||||||
}
|
}
|
||||||
AssertLog.info("<<[up]:IP:{},[up-content]==>{}", sessionManager.client(ctx),content);
|
AssertLog.info("<<[up2]:IP:{},[up-content]==>{}", sessionManager.client(ctx),content);
|
||||||
endsWith = content.endsWith("@tong-ran");
|
endsWith = content.endsWith("@tong-ran");
|
||||||
//判断是否是整包
|
//判断是否是整包
|
||||||
if(endsWith){
|
if(endsWith){
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class AgentEncoderHandler extends ChannelOutboundHandlerAdapter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AssertLog.info(">>[down]:IP:{},[content]==>{}", sessionManager.client(ctx), entity.getData());
|
AssertLog.info(">>[down]:IP:{},[content]==>{}", sessionManager.client(ctx), entity.getData());
|
||||||
String json = "agent-server:"+JSON.toJSONString(entity)+"@tong-ran";
|
String json = JSON.toJSONString(entity);
|
||||||
byte[] bytes = json.getBytes(StandardCharsets.UTF_8); // 显式指定 UTF-8
|
byte[] bytes = json.getBytes(StandardCharsets.UTF_8); // 显式指定 UTF-8
|
||||||
// byte[] bytes = EscapeUtil.hexStringToByteArray(entity.getContent());
|
// byte[] bytes = EscapeUtil.hexStringToByteArray(entity.getContent());
|
||||||
ByteBuf buf = Unpooled.wrappedBuffer(bytes);
|
ByteBuf buf = Unpooled.wrappedBuffer(bytes);
|
||||||
|
|||||||
Reference in New Issue
Block a user