[rabbitmq-discuss] RabbitMQ: Implementing "Topic" feature of ActiveMQ via RabbitMQ.

Matthias Radestock matthias at rabbitmq.com
Mon Jul 11 14:01:41 BST 2011


On 08/07/11 11:42, GURPREET SINGH wrote:
> The producer produces messages and receiver receives /all/ the messages,
> which are published after the time it has first connected to the queue.
>
> [...]
>
> A consumer C1 creates a queue Q1 which is exclusive and durable. Now it
> is down for some time and in the meantime another user C2 tries to
> connect to queue Q1. C2 will be successfull since, Q1 has now no
> subscriber connected to it. So, C2 gets connected to the exclusive and
> durable queue. Now, if C1 tries to connect to queue Q1 it cannot do so,
> since already a consumer C2 is subscribed to the queue Q1.
>
> How one can prevent such scenario ?

If you want multiple consumers to receive the same message then you need 
multiple queues, e.g. one per consumer - see 
http://www.rabbitmq.com/tutorials/tutorial-three-python.html. And in 
order to get the equivalent of durable subscriptions, the queues need to 
be durable, non-exclusive and explicitly named.

So simply get each consumer to declare a durable, non-exclusive named 
queue on start up, bind it to the desired exchange, and then start 
consuming. Since all these operations are idempotent, a clients can 
execute them on startup even when the referenced queues/bindings already 
exist from a previous invocation.

Regards,

Matthias.


More information about the rabbitmq-discuss mailing list