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.
2条答案
按热度按时间xggvc2p61#
您正在获取错误的交货标签,该标签已被确认或从不存在于当前渠道中。请查看应用程序源代码以了解如何发生这种情况。
zhte4eai2#
在我的例子中,我的消费者启用了
autoAck
,并且在处理后手动确认消息。手动确认抛出了您所遇到的相同错误。删除手动确认后,我没有再次看到该错误。
要添加到@pinepain的答案中,双重确认会引发异常并根据以下相关RabbitMQ docs关闭通道: