[rabbitmq-discuss] Quick question: Writing to multiple queues

Michael Klishin michael.s.klishin at gmail.com
Sat Jul 9 20:15:21 BST 2011


2011/7/9 Demiss Zike <habtdemis at gmail.com>

> On the receiving end of my application, I declared another queue (q3) and
> bind it to the same exchange. Then when I consume messages I consume from q3
> via the exchange I declared. But I don't expect to get any messages since I
> send the messages to queues q1 and q2 but requesting a message from q3. The
> problem is, I still get messages. I could be asking a lot but please bear
> with me. Please look at the code I have and point me to the right direction:


Demiss,

Maybe pictures demonstrate how AMQP works better. Here is the "Hello, world"
of messages over AMQP (1 app publishes a message, another one receives it):

https://github.com/ruby-amqp/amqp/raw/master/docs/diagrams/001_hello_world_example_routing.png

An example of a chat, Twitter-like service or any other broadcasting using
fanout exchange type:

https://github.com/ruby-amqp/amqp/raw/master/docs/diagrams/002_blabbr_example_routing.png


If you send a message to a fanout exchange, it is delivered to all the
queues bound to it, unconditionally. Then if there are consumers
(subscribers, added with BasicConsume method) on any of these queues,
RabbitMQ will push messages out to them. If you want only some of the queues
to get the message, you need a different exchange type (if so, could you
please re-state desired outcome one more time? I am a little confused).
-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110709/37e8565f/attachment.htm>


More information about the rabbitmq-discuss mailing list