RabbitMQ: Pushing Messages to the Back of the Queue on NAck
Join the DZone community and get the full member experience.
Join For FreeSome useful discussion on the RabbitMQ mailing list looked at a way to push messages to the back of a queue upon negative acknowledgement. Here was the scenario:
> Scenario: > I'm processing messages from a queue with confirmation required. > The number of messages relative to the consumption rate can be quite > high at times. In excess of hundreds of thousands of messages, with > consumption rate in the low hundreds per second range. >> Sometimes we have to abandon processing a message for some transient > reason (eg: external resource is locked/unavailable), and so we send a > NAck. > At the moment, RabbitMQ will immediately redeliver that message to any > of the consumers. If the transient condition is still in place, we can > potentially get into a tight loop where we're constantly consuming the > same message(s) hundreds of times per second. >> For our scenario, we *can* duplicate the message, send it to the > exchange/queue, and Ack the original.
The advice on this email has some good suggestions for how to prevent getting into a tight loop.
Opinions expressed by DZone contributors are their own.
Comments