<br><br><div class="gmail_quote">2011/7/9 Demiss Zike <span dir="ltr">&lt;<a href="mailto:habtdemis@gmail.com">habtdemis@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

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&#39;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:</blockquote>

</div><br>Demiss,<br><br>Maybe pictures demonstrate how AMQP works better. Here is the &quot;Hello, world&quot; of messages over AMQP (1 app publishes a message, another one receives it):<br><br><a href="https://github.com/ruby-amqp/amqp/raw/master/docs/diagrams/001_hello_world_example_routing.png">https://github.com/ruby-amqp/amqp/raw/master/docs/diagrams/001_hello_world_example_routing.png</a><br>

<br>An example of a chat, Twitter-like service or any other broadcasting using fanout exchange type:<br><br><a href="https://github.com/ruby-amqp/amqp/raw/master/docs/diagrams/002_blabbr_example_routing.png">https://github.com/ruby-amqp/amqp/raw/master/docs/diagrams/002_blabbr_example_routing.png</a><br>

<br><br>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).<br>

-- <br>MK<br><br><a href="http://github.com/michaelklishin" target="_blank">http://github.com/michaelklishin</a><br><a href="http://twitter.com/michaelklishin" target="_blank">http://twitter.com/michaelklishin</a><br><br>