为什么 rabbitmq 不断记录未知的交付标签"basic.ack"?



RabbitMQ保持日志记录

=ERROR REPORT==== 24-Aug-2014::06:25:07 ===
connection <0.109.6880>, channel 1 - soft error:
{amqp_error,precondition_failed,"unknown delivery tag 1",'basic.ack'}

日志文件相当大

您正在打包错误的交付标签,该标签已被打包或在当前渠道中从未存在。

在我的例子中,我的消费者启用了autoAck,并且在处理后也手动确认消息。手动确认抛出了与您遇到的相同的错误。

一旦我删除了手动确认,我就不会再看到错误了。

添加到@pinepain的答案,双确认抛出一个异常,并关闭这些相关的RabbitMQ文档的通道:

When manual acknowledgements are used, it is important to consider what thread does the acknowledgement. If it's different from the thread that received the delivery (e.g. Consumer#handleDelivery delegated delivery handling to a different thread), acknowledging with the multiple parameter set to true is unsafe and will result in double-acknowledgements, and therefore a channel-level protocol exception that closes the channel. Acknowledging a single message at a time can be safe.

最新更新