master
fst1996 2023-12-05 16:35:50 +08:00
parent 442df5ca72
commit b835edeabe
1 changed files with 9 additions and 3 deletions

View File

@ -37,8 +37,14 @@ public class RabbitConsumer {
}
@RabbitListener(queuesToDeclare = {@Queue("IN_FENCE")})
public void two(String msg){
public void two(String msg,Message message, Channel channel){
try {
log.info("监听到消息:{} , 队列名:{}",msg,"IN_FENCE");
log.info("车辆驶入围栏,消息是:{}",msg);
//手动确认
channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}