Rabbitmq: Unacked message not going away after broker restart

微笑、不失礼 提交于 2019-12-11 02:31:08

问题


We have observed the following behavior of RabbitMQ and are trying to understand if it is correct and how to resolve it.

Scenario:

  1. A (persistent) message is delivered into a durable queue
  2. The (single) Consumer (Spring-AMQP) takes the message and starts processing => Message goes from READY to UNACK
  3. Now the broker is shut down => Client correctly reports "Channel shutdown"
  4. The consumer finishes the processing, but can not acknowledge the message as the broker is still down
  5. Broker is started again => Client reconnects

As a result, one message remains unack'ed forever (or until the client is restarted).

Side note: In the Rabbit Admin UI, I can see that two channels are existing now. The "dead" one that was created before the broker restart, containing the unacked message and a new one that is healthy.

Is this behavior expected to be like that? It seems to me "correct" in the way, that RabbitMQ can not know after the broker restart, whether the message processing was completed or not. But what solution would exist than to get that unacked message back into the queue and to heal the system without restarting the consumer process?


回答1:


The RabbitMQ team monitors this mailing list and only sometimes answers questions on StackOverflow.


Is this behavior expected to be like that? It seems to me "correct" in the way, that RabbitMQ can not know after the broker restart, whether the message processing was completed or not.

Yes, you are observing expected behavior. RabbitMQ will re-enqueue the message once it determines that the consumer is really dead. Since your consumer re-connects with what must be the same consumer tag as before, it is up to that process to ack or nack the message.



来源:https://stackoverflow.com/questions/48905721/rabbitmq-unacked-message-not-going-away-after-broker-restart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!