Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

RabbitMQ: Pushing Messages to the Back of the Queue on NAck

DZone's Guide to

RabbitMQ: Pushing Messages to the Back of the Queue on NAck

· Integration Zone ·
Free Resource

The State of API Integration 2018: Get Cloud Elements’ report for the most comprehensive breakdown of the API integration industry’s past, present, and future.

Some 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.


Your API is not enough. Learn why (and how) leading SaaS providers are turning their products into platforms with API integration in the ebook, Build Platforms, Not Products from Cloud Elements.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}