Pivotal Knowledge Base

Follow

Why are messages lost when I restart a RabbitMQ broker?

Symptom

You have several messages in queue and for some reason you need to restart the broker. Once the broker was restarted your messages in the queue are gone.

Resolution

Here are some points you need to check why messages are not persisting.

Queues declared as durable

Objects such as queues, exchanges needs to be configured as durable in order to survive a restart. Although this will not make the messages that goes through these objects as durable, but next time you restart the broker the queues/exchange are not deleted. 

Here are a few ways to create a durable queue:


Message delivery mode set to persistent

Message can be published either having a delivery mode set to persistent or transient . Here are a few ways to mark messages as persistent:

 

Marking the queue as durable and setting delivery mode to persistent will be able to reduce but does not guarantee no message loss. It is recommended to mix this with rabbit's reliability features. 

Comments

Powered by Zendesk