<br><br><div class="gmail_quote">On Tue, Jan 25, 2011 at 10:35 AM, Marek Majkowski <span dir="ltr">&lt;<a href="mailto:majek04@gmail.com">majek04@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Jan 25, 2011 at 18:22, Dan Tenenbaum &lt;<a href="mailto:dtenenba@fhcrc.org">dtenenba@fhcrc.org</a>&gt; wrote:<br>
&gt;&gt; If you haven&#39;t done so already, I recommend reading<br>
&gt;&gt; <a href="http://www.rabbitmq.com/tutorial-three-python.html" target="_blank">http://www.rabbitmq.com/tutorial-three-python.html</a><br>
&gt;&gt;<br>
&gt;<br>
&gt; I have read this, thanks.<br>
&gt; Here is an attempt that uses two fanout exchanges and two queues, one bound<br>
&gt; to each exchange with &#39;#&#39;. You would think (well, I would think) that any<br>
&gt; message sent to either of these fanout exchanges is going to go to every<br>
&gt; consumer of every queue bound to the appropriate exchange.<br>
<br>
</div>If N messages go to the queue, exactly N messages will go out, no<br>
matter how many consumers are hanging on that queue.<br>
<br>
If N messages go to the exchange, any number may go out, depending on bindings.<br>
<br>
Exchanges - broadcast.<br>
Queues - buffering.<br>
<div class="im"><br></div></blockquote><div><br></div><div>I think I understand this. That&#39;s why in my code, I publish messages to an exchange, not a queue.</div><div><br></div><div>I am looking at the python example 3 code on the rabbitmq site (<a href="http://www.rabbitmq.com/tutorial-three-python.html">http://www.rabbitmq.com/tutorial-three-python.html</a>). If I run this code on my own machine, with multiple instances of receive_logs.py, it works as I would like my own code to work: each instance of receive_logs.py gets a copy of each message sent by emit_logs.py.�</div>
<div><br></div><div>I got my code to work by using an un-named exclusive queue in each receiver:</div><div><br></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">from_builders_queue = channel.queue_declare(exclusive=True)</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">from_builders_queue_name = from_builders_queue.queue</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br>
</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">from_web_queue = channel.queue_declare(exclusive=True)</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">from_web_queue_name = from_web_queue.queue</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">channel.queue_bind(exchange=&#39;from_web_exchange&#39;, queue=from_web_queue_name)</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">channel.queue_bind(exchange=&#39;from_worker_exchange&#39;, queue=from_builders_queue_name)</font></div></div><div><br></div><div><br></div><div>
�</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
&gt; However, what happens in practice is only one receiver at a time gets a<br>
&gt; message.<br>
<br>
</div>You need to have exactly as many queues as many copies of the message<br>
you&#39;d like to receive.<br>
<br>
Once again: a message distributed to queue will not be copied to<br>
multiple consumers. It will<br>
be distributed to a single consumer only.<br>
<br></blockquote><div><br></div><div>Thanks for your help.</div><div>Dan</div><div><br></div></div>