I am going through the documentation of AMQP given by Rabbitmq official site. It says that
Queue Durability Durable queues are persisted to disk and thus survive broker restarts. Queues that are not durable are called transient. Not all scenarios and use cases mandate queues to be durable.
Durability of a queue does not make messages that are routed to that queue durable. If broker is taken down and then brought back up, durable queue will be re-declared during broker startup, however, only persistent messages will be recovered.
However I am confused about following scenarios, when Message broker crashes :-
In all the above cases, will the messages be available on next start of rabbit-mq server ?
Moreover, the documentation makes distinction between normal message and persistent messages, as only persistent messages will be recovered. What's the difference between both message types ?
Thanks in advance.
A durable queue will persist after a broker restart. This mean that after a restart the queue will be recreated automatically without the need you create it again manually. This only ensures that the queue is going to continue existing but not any messages that it contains.
Now, persistent messages will be written to disk as soon as they reach the queue, this is independent of the queue (durable or not).
So answering your questions. If you want your messages to be recovered after a restart, declare them persistent always. Supposing that, your scenarios will be:
Notice that persistent message has no effect inside a non-durable queue; When the server restarts, the queue will not be recreated and thus the messages will not be recreated from the persistency log file. This is also true for every non-durable queue that the message may be routed to: Once a message is routed to a non-durable queue it gets deleted from the persistency log file and is not considered persistent anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With