<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; ">
<div>Hi --</div>
<div><br>
</div>
<div>I am experiencing a behavior I didn't expect--and don't understand :( In the following simplified code:</div>
<div><br>
</div>
<div>
<div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; try:</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.out_channel.exchange_declare\</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ( exchange=exchange</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; , type=&quot;topic&quot;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; , passive=False</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; , durable=True</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; , auto_delete=False</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; , nowait=True</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg_props = pika.BasicProperties(content_type=&quot;application/json&quot;, delivery_mode=2)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.out_channel.basic_publish\</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ( body=message</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; , exchange=exchange</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; , properties=msg_props</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; , routing_key=routing_key</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; except pika.exceptions.AMQPError:</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.logger.exception(&quot;Message not sent&quot;)</div>
</div>
</div>
<div><br>
</div>
<div>The&nbsp;exchange_declare above&nbsp;seems to block indefinitely; out-channel is a channel obtained from a blocking connection.</div>
<div><br>
</div>
<div><span class="Apple-style-span">Here's the context:&nbsp;node N1 (which contains the above code) uses&nbsp;</span>pika.BlockingConnection<span class="Apple-style-span">&nbsp;to communicate with the broker, which is connected to two other nodes N2 and N3. Upon receiving
 a message from N2 via a fanout exchange, N1 acknowledges it and then sends N2 a message over a different, topic exchange. The interaction between N1 and N3 follows an identical pattern.</span></div>
<div><span class="Apple-style-span"><br>
</span></div>
<div><span class="Apple-style-span">I noticed that when both N2 and N3 send messages to N1, the above code works as I thought it would only for one of them (say N2), while the exchange_declare hangs for the other (N3). The code works fine if I comment out the
 exchange_declare call. N1 uses 2 channels, one for incoming messages (fanout exchange) and one for outgoing messages (topic exchange).</span></div>
<div><span class="Apple-style-span"><br>
</span></div>
<div><span class="Apple-style-span">I am using RabbitMQ 3.0.0 and pika 0.9.8.</span></div>
<div><span class="Apple-style-span"><br>
</span></div>
<div>Many (but not) all samples invoke&nbsp;exchange_declare as I did above (as it is idempotent) so I assume that I'm missing something rather than making a call I should not make. FWIW the&nbsp;exchange_declare for N1's other, fanout exchange never hangs.</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>-dm</div>
<div><span class="Apple-style-span"><br>
</span></div>
<div><span class="Apple-style-span"><br>
</span></div>
</body>
</html>