0

Not to worry: you can have your consumers reconnect to the cluster and recreate the queues, right? Only if the queues weren’t originally marked durable. If the queues being re-created were marked as durable, redeclaring them from another node will get you an ugly 404 NOT_FOUND error. This ensures messages in that queue on the failed node don’t disappear when you restore it to the cluster. The only way to get that specific queue name back into the cluster is to actually restore the failed node. But if the queues your consumers try to re-create are not durable, the redeclarations will suc- ceed and you’re ready to rebind them and keep trucking.

In the author says that durable queue cannot be redeclared for eusuring data not lossing , How to comprehend this?

4

1 回答 1

1

问题在于 RabbitMQ 将发布的消息保存在哪里。如果您在节点 A 中声明一个队列,则队列消息将存在于该节点中。复制的是队列元数据,即队列属性,而不是消息。因此,如果节点 A 死亡,那么在该节点中,您将拥有已发布到该队列的消息。

因此,假设现在您转到节点 B 并重新声明该队列,该队列也是持久的,就像在节点 A 中一样。如果允许该过程,那么您将丢失来自节点 B 的所有消息,因为代理会认为该队列存在在节点 B。

于 2012-11-01T11:47:22.223 回答