RabbitMQ - what is the difference between persistency and durability?

People often mix up these two terms in RabbitMQ - persistent and durable. Here I will clarify these and show how they differ. They both have importance when it comes to RabbitMQ being restarted or even worse - down.

First of all: Queues can be durable and messages can be persistent.

A persistent message is a message that has been written to the disk. It is the publisher which makes the decision to make a message persistent. So when the publisher gets an acknowledgement back (Publish Confirm), the message is saved on the disk. If it is not durable the message resides in memory (unless Rabbit runs out of memory). If RabbitMQ is restarted all non-persistent messages will be lost.

Durable queues are queues that can survive a restart of RabbitMQ. If a queue is not durable it will be gone if RabbitMQ shuts down for any reason - along with all the messages.

So both of these configurations will have to be true for messages to survive restarts. Your messages will have to be persistent and your queues durable.

Any questions? leave them in the comments!