In RabbitMQ, what role does message acknowledgment (ack) play in preventing message loss?
Think about how RabbitMQ knows when it can delete a message from the queue.
Message acknowledgment tells RabbitMQ that the consumer has successfully processed the message. Without this, RabbitMQ might delete the message too early, causing loss if the consumer crashes.
What is the output of the following RabbitMQ command when declaring a durable queue?
rabbitmqadmin declare queue name=myqueue durable=true
Durable queues survive broker restarts. Check the durable field in the output.
The durable flag set to true means the queue will survive RabbitMQ restarts, preventing message loss.
Which sequence of steps correctly ensures no message loss when using RabbitMQ with consumers?
Think about the order from queue setup to message publishing, confirming, and acknowledging.
First, the queue must be durable. Then messages are published as persistent. Consumers acknowledge messages after processing. Publisher confirms ensure the broker received the message.
You declared a durable queue and published persistent messages, but messages are lost after RabbitMQ restarts. What is the most likely cause?
Durable queues alone do not guarantee message persistence.
Messages must be published as persistent (delivery_mode=2) to survive broker restarts. Durable queues only ensure the queue itself survives.
In a RabbitMQ cluster with mirrored queues, which practice best prevents message loss during node failures?
Think about how RabbitMQ replicates messages and confirms delivery.
Mirrored queues replicate messages across nodes, and publisher confirms ensure the broker received messages. This combination prevents message loss during node failures.