[rabbitmq-discuss] Multiple consumers of one exchange

Simon MacMullen simon at rabbitmq.com
Mon Nov 28 17:22:00 GMT 2011


The behaviour you're seeing is by design - the idea is that for a single 
queue each message will only go to one consumer (but may be redelivered 
if the consumer dies without acking the message - this is what you're 

You need to make sure each consumer has its own queue if every consumer 
should receive all messages.

You will want durable non-exclusive non-autodelete queues for this. It 
might be convenient to use server-named queues, in which case each 
consumer will have to stash the queue name somewhere while it is not 

And yes, x-message-ttl would be useful in case a consumer does not come 
back for a while. x-expires might be useful too.

Cheers, Simon

On 28/11/11 16:53, evkdev at gmail.com wrote:
> Hi!
> I have a durable Fanout exchange, where one or more producers post their
> messages. Multiple consumers are working with this exchange, each with
> it’s own queue binded to this exchange.
> I want all consumers can receive all messages for (for example) last
> week, if they are listening now or not. So suppose I open some
> application and start listening. I want to receive all messages for the
> last week first, and then receive incoming messages too (together with
> other consumers). How can I do that? First, I created one named queue
> with x-message-ttl of one week, binded to the exchange. When receiving a
> message from this queue, I’m not sending ack. So every time I open
> application, I indeed see all messages. But if I have two clients
> connected, only first one receives all messages. Second one receives
> them only if I close first consumer. The same is when each consumer has
> it’s own queue. When multiple clients connected – only one of them
> receives a message. What am I doing wrong? How can I get the desired
> behavior?
> Thanks.
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Simon MacMullen
RabbitMQ, VMware

More information about the rabbitmq-discuss mailing list