为什么rabbitmq一直记录未知的投递标签“basic.ack”?

flvtvl50  于 2022-11-08  发布在  RabbitMQ
关注(0)|答案(2)|浏览(170)

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'}

日志文件相当大。

xggvc2p6

xggvc2p61#

您正在获取错误的交货标签,该标签已被确认或从不存在于当前渠道中。请查看应用程序源代码以了解如何发生这种情况。

zhte4eai

zhte4eai2#

在我的例子中,我的消费者启用了autoAck,并且在处理后手动确认消息。手动确认抛出了您所遇到的相同错误。
删除手动确认后,我没有再次看到该错误。
要添加到@pinepain的答案中,双重确认会引发异常并根据以下相关RabbitMQ docs关闭通道:

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.

相关问题