This commit is contained in:
2024-09-20 10:42:19 +08:00
parent ebcc80d71a
commit 33650aad94
4 changed files with 32 additions and 5 deletions

View File

@@ -160,6 +160,19 @@ public class PushToClientChannelHandlerAdapter extends NettyChannelHandlerAdapte
});
}
@Async
public void AppSendInfo(String message, String shopId) {
log.info("长链接发送交班数据。");
ConcurrentHashMap<String, ChannelHandlerContext> webSockets = webSocketMap.get(shopId);
if (webSockets != null) {
for (ChannelHandlerContext ctx : webSockets.values()) {
sendMesToApp(message, ctx);
}
}
}
//发送打印消息 有重发机制
public void AppSendInfoV1(String shopId, String orderNo, JSONObject message) {
log.info("netty连接client 发送消息 shopId:{} clientId:{} userFlag:{} message:{}", shopId, message.get("orderInfo"));
retryQueue.computeIfAbsent(shopId, k -> new ConcurrentLinkedQueue<>()).offer(message);