[rabbitmq-discuss] Single Queue With Multiple Consumers

Matthias Radestock matthias at rabbitmq.com
Sat Jul 16 09:50:48 BST 2011


On 16/07/11 09:40, Simone Busoli wrote:
> On Jul 16, 2011 9:30 AM, "DarthMaul" <screechrocks at gmail.com> wrote:
>  > So lets say you have 1 producer, 20 messages, and 5 consumers. I want
>  > each consumer to be "assigned" one message to start it off, so 15
>  > messages are left. Then as each consumer gets done, he grabs the next
>  > one. And so on.
>
> I think you can achieve this by simply using a single queue, having your
> producer publish directly to it and the consumers consuming from it.

You'll also need to set the basic.qos prefetch to 1. See the section on 
"Fair dispatch" in 
http://www.rabbitmq.com/tutorials/tutorial-two-python.html.

Matthias.


More information about the rabbitmq-discuss mailing list