[rabbitmq-discuss] can rabbitmq(amqp) do this for me?

Michael Klishin michael.s.klishin at gmail.com
Mon Mar 3 10:00:41 GMT 2014

2014-03-03 13:52 GMT+04:00 Li Li <fancyerii at gmail.com>:

>     I want to use something like a message queue to implement a
> distributed system. there are one producer and many consumers to
> balance the load. messages will be randomed dispatched to all the
> consumers. if one consumer receive a message, it will process this
> message. but sometimes this particular consumer will be unable to
> process this message, it can 'refuse' this message and other consumers
> can process this one?

There is a couple of ways to do it:

 * Use a single queue per consumer (straightforward, not scalable with
large message volumes) and basic.reject. This will give you round-robin
distribution between consumers.

See tutorial 2:
http://www.rabbitmq.com/getstarted.html if this sounds appropriate for your

 * Use a queue per consumer, (mostly) evenly distribute messages between
them using
x-random or x-consistent-hash exchanges:


(the latter ships with recent RabbitMQ versions but need to be enabled
using rabbitmq-plugins).

In this case to refuse processing a message, consumers will have to
republish them
to the exchange. This in turn requires more careful error handling logic in
your consumers.

The latter approach is much more scalable.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140303/fbb27319/attachment.html>

More information about the rabbitmq-discuss mailing list