RabbitMQ死信处理保证

时间:2019-06-25 09:27:32

标签: rabbitmq spring-amqp reliability dead-letter

如果我使用发布者确认,则可以(合理地)确保即使RabbitMQ服务器崩溃(例如断电),发送到RabbitMQ服务器上的交换机以及从RabbitMQ服务器接收到ACK的消息也不会丢失。 )。

但是,如果在用户手动拒绝后消息到达死信交换,会发生什么情况? (channel.basicReject,我使用Spring AMQP。)

我仍然可以确定在原始消息从使用者正在监听的队列中出队并且RabbitMQ服务器随后崩溃的情况下,在RabbitMQ服务器重新启动后,我最终会找到该消息,在与死信交换绑定的队列中(如果正常情况下消息会到达那里)?

如果答案是否定的,是否有办法确保确实如此?

1 个答案:

答案 0 :(得分:1)

正如@GaryRussell所建议的,我在rabbitmq-users Google网上论坛上发布了类似的问题。

这是我从达尼尔·费多托夫(Daniil Fedotov)那里得到的答案

"Hi,

There is no delivery guarantees in place. Dead lettering does not check if the message was enqueued or saved to disk.
Dead-lettering does not use publisher confirms or any other confirm mechanisms.

It's not that easy to implement reliable dead-lettering from one queue to another and there are plans to address this issue eventually, but it may take a while.

If you want to safely reject messages from the consumer without a risk of losing them - you can publish them from the consumer application manually to the dead-letter queue, wait for the confirmation and then reject."