In RabbitMQ, what happens when a consumer uses manual acknowledgments but fails to send an acknowledgment for a received message?
Think about what RabbitMQ does to ensure messages are not lost if a consumer crashes.
When manual acknowledgments are used, RabbitMQ waits for the consumer to send an acknowledgment. If the consumer disconnects without acknowledging, the message is requeued for delivery to another consumer.
What is the output behavior when a RabbitMQ consumer is started with autoAck=true and the consumer crashes before processing the message?
channel.basicConsume(queueName, true, consumer);
Auto-ack means the message is acknowledged as soon as it is delivered.
With autoAck=true, RabbitMQ considers the message acknowledged immediately upon delivery, so if the consumer crashes before processing, the message is lost.
Arrange the steps in the correct order for a RabbitMQ consumer using manual acknowledgments to process a message safely.
Acknowledge only after successful processing.
The consumer must first receive the message, then process it. If processing succeeds, it sends an acknowledgment. Errors should be handled after processing and before acknowledgment.
A RabbitMQ consumer using manual acknowledgments notices duplicate messages being processed. Which of the following is the most likely cause?
Think about what happens if messages are not acknowledged.
If messages are not acknowledged manually, RabbitMQ will requeue them when the consumer disconnects, causing duplicates when redelivered.
Which consumer acknowledgment strategy best ensures that messages are processed exactly once, even if the consumer crashes during processing?
Consider when to send acknowledgment to avoid message loss or duplication.
Manual acknowledgment after successful processing ensures messages are not lost or duplicated, even if the consumer crashes during processing.