[rabbitmq-discuss] Binding queues on a topic exchange

Ben Hood 0x6e6562 at gmail.com
Tue Jul 3 07:15:29 BST 2007


Matthias,

> Let me rephrase that slightly: You have declared a topic exchange and a
> queue bound to that exchange with a particular pattern. Your consumers
> all consume messages from that queue. Correct?

Correct.

>
> > b) Declares a privately named queue and binds a routing key to that
> > queue that the consumer is interested in listening to.
>
> Let me rephrase that slightly: You have declared a topic exchange (as
> before). Each consumer creates a private queue that it binds to the
> topic exchange with a particular pattern. Correct?

Correct.

>
> > My assumption would be that in scenario (a), each consumer gets
> > notified using the same shared data whereas in (b) a copy of each
> > message is enqueued in the buffer of the consumer's private queue,
> > thus making this queue not really a pub/sub, but more really P2P.
> >
> > Is this assumption correct?
>
> For a topic exchange, a message gets delivered to all queues that match
> the message's routing key with their binding pattern.
>
> When you have multiple consumers on one queue, every message gets
> delivered to *one* of the consumers.
>
> So, taking your above cases, in the first example every message with a
> matching routing key will be delivered to *one* of the consumers, and in
> the second case every message with a given routing key is delivered to
> *all* queues that match the routing key with their pattern, and then in
> turn to the consumer(s) hanging off those queues (one per queue in this
> example).

So in order to have all consumers receive a copy of every piece of
published data (e.g. for a price feed) you would have to go for option
(b). Is this correct?

BTW, the clarity of your answers is appreciated,

Ben




More information about the rabbitmq-discuss mailing list