<div>
                    <br>
                </div>
                <div></div>
                 
                <p style="color: #A0A0A8;">On Wednesday, September 7, 2011 at 2:45 PM, Christopher Lefevre wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">



<div class="WordSection1">
<p><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;; color:#1F497D">Only using one connection is the point of this modification.</span></p></div></div></div></span></blockquote><div>Oh that's easy then.&nbsp;</div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span><div><div><div class="WordSection1">
<p><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;; color:#1F497D">I already have a setup that does an asynchronous call that instantiates a Pika Publisher to publish a message to the queue, and a Pika Monitor to consume messages. However those each create their own connection and ioloops.</span></p></div></div></div></span></blockquote><div>No need for that.&nbsp;</div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span class="Apple-style-span" style="color: rgb(31, 73, 125); font-family: Calibri, sans-serif; font-size: 15px; ">Am I chasing my tail trying to get multiple channels created for a single connection? Then creating a queue on each channel, one to monitor, one to publish
 to?</span></blockquote><div>You don't need a channel per queue really, but it should be easy to create -- this is more pseudocode, but should get the spirit across:</div><div><br></div><div>conn = FooConnection(on_connection_open)</div><div><div>conn.ioloop.start()</div></div><div><br></div><div>def on_connection_open(conn):</div><div>&nbsp; conn.channel(on_channel_one_open)</div><div>&nbsp; conn.channel(on_channel_two_open)</div><div><br></div><div>def on_channel_one_open(channel):</div><div>&nbsp; global channel_one</div><div>&nbsp; channel_one = channel</div><div><div>&nbsp; channel_one.create_queue(on_monitor_queue_created)</div></div><div><br></div><div>def on_monitor_queue_created(frame)</div><div>&nbsp; channel_one.basic_consume('routing_key', monitor_consumer_function)</div><div><br></div><div>def on_channel_two_open(channel):</div><div>&nbsp; global channel_two</div><div><div>&nbsp; channel_two = channel</div></div><div>&nbsp; for x in xrange(0, 10000):</div><div>&nbsp; &nbsp; publish_consumer_function(x)</div><div><br></div>