RabbitMQ Acknowledgment Modes: Auto vs Manual
Fast recall
Quick revision
Core answer
Understanding of at-least-once delivery guarantees and the trade-offs between reliability and throughput.
Using auto-ack in production for critical workflows, or forgetting to ack messages in manual mode (causing the queue to fill up with unacked messages that block consumers).
Explain prefetch count (basicQos) and how it interacts with manual ack to control back-pressure, and mention that unacked messages are re-delivered if the channel closes.
Interview-ready guide
Interview answer
Message acknowledgment controls when RabbitMQ considers a message successfully delivered. The Spring AMQP terminology trips people up because Spring has three modes that don't map directly to AMQP's two protocols.
The three Spring modes:
NONEis true fire-and-forget — the broker deletes the message on delivery before processing completes; if the consumer crashes, the message is gone; use only for metrics or telemetry where loss is acceptableAUTOis the safe default — it uses manual acknowledgment at the protocol level but handles it automatically; the container acks after your listener returns without throwing, and nacks with requeue on exception; covers most use cases without writing ack codeMANUALis for workflows needing explicit control: payment processing where you want to ack only after the database transaction commits, or where you need to distinguish transient failures (requeue for retry) from permanent ones (dead-letter immediately)
Prefetch — the critical companion:
- Without prefetch limits, the broker floods one consumer with messages while others sit idle; set prefetch to 1 for the fairest distribution across competing consumers, or 10–20 for a throughput-fairness balance
requeue=falseinbasicNacktriggers DLX routing;requeue=trueputs the message back at the queue head and can create a hot-loop on poison messages
The silent failure mode in manual ack:
- Forgetting to ack or nack on any code path leaves messages unacked; the prefetch limit fills up; the consumer silently stops receiving with no error in logs — no exception, just a hung consumer
I recommend AUTO as the default and only switching to MANUAL when you need to explicitly tie the ack to a database transaction commit or to distinguish failure types.
RabbitMQ Acknowledgment Modes: Auto vs Manual
Direct Answer
Auto-ack acknowledges messages immediately upon delivery before processing, risking message loss if the consumer crashes. Manual ack gives the consumer full control — it explicitly calls basicAck on success or basicNack/basicReject on failure, ensuring messages are not lost and can be requeued or dead-lettered.
Common Mistakes & Pitfalls
Using auto-ack in production for critical workflows, or forgetting to ack messages in manual mode (causing the queue to fill up with unacked messages that block consumers).
Check your understanding
Answer these without looking back at the article.
- What is prefetch count and how does it prevent a consumer from being overwhelmed?
- What happens to unacknowledged messages when a consumer disconnects?
- How do you configure ack mode per listener rather than globally in Spring Boot?
Related interview prep categories
1Want a guided curriculum order?
These modules are also sequenced in our flagship backend interview track — open it when you prefer an ordered path instead of browsing by topic.