RabbitMQ消费端报:delivery acknowledgement on channel 5 timed out. Timeout value used: 1800000 ms. This t

场景:

消费端日志控制台报如下错误:

2022-11-25 13:18:29.354 ERROR 13368 --- [.15.178.36:5672] o.s.a.r.c.CachingConnectionFactory       :1575 - Channel shutdown: channel error; protocol method: #method(reply-code=406, reply-text=PRECONDITION_FAILED - delivery acknowledgement on channel 5 timed out. Timeout value used: 1800000 ms. This timeout value can be configured, see consumers doc guide to learn more, class-id=0, method-id=0)

分析:

1、rabbitmq开启手动确认模式之后,但是在消费消息之后没有确认导致
2、消息确认超时的间隔太短导致

解决:

1、在消费端消费后,无论消费正常还是异常,都要ack确认

channel.basicAck(deliveryTag, false);
或
channel.basicNack(deliveryTag, false, false);
或
channel.basicReject(deliveryTag, false);

2、在 r

你可能感兴趣的:(MQ,异常和开发经验总结,rabbitmq)