增加box推送空字符串过来时,不处理请求编号+1

This commit is contained in:
wulin 2023-10-29 22:19:40 +08:00
parent bb7728c025
commit 588e823357
2 changed files with 13 additions and 0 deletions

View File

@ -18,5 +18,13 @@ import java.io.IOException;
@Component
@Slf4j
public class YunxiListener {
@RabbitListener(queues = YunxiRabbitConst.QUEUE_YUNXI, containerFactory = "simpleRabbitListenerContainerFactory")
public void processYunxiQueue(Channel channel, Message message) throws IOException {
String messageContent = new String(message.getBody(), "UTF-8");
System.out.println("YunxiListener msg " + messageContent);
//TODO 消费者处理程序
//处理完毕 手动消息确认 配置需开启 acknowledge-mode: manual
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
}
}

View File

@ -151,6 +151,11 @@ public class BoxWebSocketHandler implements WebSocketHandler {
return baseWebSocketService.closeSendMsg(boxSession, "设备信息不全", AskTypeEnum.TIME.getCode());
}
log.info("收到SN:{},消息:{}", boxTalkMessage.getSn(), boxTalkMessage.getMessage());
if(StringUtils.isEmpty(boxTalkMessage.getMessage())){
log.info("收到空字符串,不处理,请求编号+1");
boxSession.setRequestId(boxSession.getRequestId() + 1);
return Mono.empty();
}
return nlpService.getActionWithLacSingle(
boxSession.getUserId(),
boxTalkMessage.getMessage(),