Integration / ActiveMQ Interview Questions Intermediate
What happens when a consumer fails to acknowledge a message?
If a consumer disconnects, crashes, or times out without sending an acknowledgment (in CLIENT_ACKNOWLEDGE or transacted mode), ActiveMQ treats the message as still pending and redelivers it - either to the same consumer on reconnect or to another available consumer on the same queue.
Each redelivery increments a counter tracked in the message's JMSXDeliveryCount property. Once that counter exceeds the redelivery policy's maximumRedeliveries (default 6), the broker stops retrying and routes the message to the Dead Letter Queue instead of looping forever. This protects the system from a single poison message endlessly blocking a queue while still giving transient failures, like a brief network blip or a slow database call, a chance to succeed on retry.
The exact redelivery delay is also configurable, typically starting small and increasing with an exponential back-off, so a consumer experiencing a brief hiccup gets a quick retry while one stuck in a longer outage doesn't get hammered with immediate redeliveries every few milliseconds.
More Related questions...