<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
<!--
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Tahoma}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p
        {margin-right:0in;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif"}
span.apple-style-span
        {}
span.EmailStyle19
        {font-family:"Calibri","sans-serif";
        color:#1F497D}
.MsoChpDefault
        {}
@page WordSection1
        {margin:1.0in 1.0in 1.0in 1.0in}
div.WordSection1
        {}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Thanks Gavin, that actually seems to be exactly what I had tried previously, but didn’t work correctly.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Going to re-investigate that solution that I tried and see if I just missed something in there.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">One thing that I notice actually, is you’ve declared 2 globals, which I have implemented differently, the on_open function I have is defined as: def _on_channel_open(self,
channel_, callback_=None):</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Which then assigned channel_ to self.channel</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">When I implemented the change, I had self.channel, and self.monitor_channel. However everything else looks the same. Going to have to put all of that back
in at this point to double check my work. I had reverted at this point to look into alternative solutions.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">-Christopher Lefevre</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D"> </span></p>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt; font-family:"Tahoma","sans-serif""> Gavin M. Roy [mailto:gmr@myyearbook.com]
<br>
<b>Sent:</b> Wednesday, September 07, 2011 3:46 PM<br>
<b>To:</b> Christopher Lefevre<br>
<b>Cc:</b> Marek Majkowski; rabbitmq-discuss@lists.rabbitmq.com<br>
<b>Subject:</b> Re: [rabbitmq-discuss] Publish on a queue, then Monitor on a reply queue, with only 1 connection to the RabbitMQ server? Non-blocking?</span></p>
</div>
<p class="MsoNormal"> </p>
<div>
<p class="MsoNormal"> </p>
</div>
<p><span style="color:#A0A0A8">On Wednesday, September 7, 2011 at 2:45 PM, Christopher Lefevre wrote:</span></p>
<blockquote style="border:none; border-left:solid windowtext 1.0pt; padding:0in 0in 0in 8.0pt; margin-left:0in; margin-top:5.0pt; margin-bottom:5.0pt">
<div>
<div>
<div>
<p><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; color:#1F497D">Only using one connection is the point of this modification.</span></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal">Oh that's easy then. </p>
</div>
<blockquote style="border:none; border-left:solid windowtext 1.0pt; padding:0in 0in 0in 8.0pt; margin-left:0in; margin-top:5.0pt; margin-bottom:5.0pt">
<div>
<div>
<div>
<p><span style="font-size:11.0pt; font-family:"Calibri","sans-serif"; 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>
</blockquote>
<div>
<p class="MsoNormal">No need for that. </p>
</div>
<blockquote style="border:none; border-left:solid windowtext 1.0pt; padding:0in 0in 0in 8.0pt; margin-left:0in; margin-top:5.0pt; margin-bottom:5.0pt">
<p class="MsoNormal"><span class="apple-style-span"><span style="font-size:11.5pt; font-family:"Calibri","sans-serif"; color:#1F497D">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></span></p>
</blockquote>
<div>
<p class="MsoNormal">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:</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">conn = FooConnection(on_connection_open)</p>
</div>
<div>
<div>
<p class="MsoNormal">conn.ioloop.start()</p>
</div>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">def on_connection_open(conn):</p>
</div>
<div>
<p class="MsoNormal"> conn.channel(on_channel_one_open)</p>
</div>
<div>
<p class="MsoNormal"> conn.channel(on_channel_two_open)</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">def on_channel_one_open(channel):</p>
</div>
<div>
<p class="MsoNormal"> global channel_one</p>
</div>
<div>
<p class="MsoNormal"> channel_one = channel</p>
</div>
<div>
<div>
<p class="MsoNormal"> channel_one.create_queue(on_monitor_queue_created)</p>
</div>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">def on_monitor_queue_created(frame)</p>
</div>
<div>
<p class="MsoNormal"> channel_one.basic_consume('routing_key', monitor_consumer_function)</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
<div>
<p class="MsoNormal">def on_channel_two_open(channel):</p>
</div>
<div>
<p class="MsoNormal"> global channel_two</p>
</div>
<div>
<div>
<p class="MsoNormal"> channel_two = channel</p>
</div>
</div>
<div>
<p class="MsoNormal"> for x in xrange(0, 10000):</p>
</div>
<div>
<p class="MsoNormal"> publish_consumer_function(x)</p>
</div>
<div>
<p class="MsoNormal"> </p>
</div>
</div>
The information contained in this electronic message and any attached document(s) is intended only for the personal and confidential use of the designated recipients named above. This message may be confidential. If the reader of this message is not the intended
recipient, you are hereby notified that you have received this document in error, and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify sender immediately
by telephone (603) 262-6300 or by electronic mail immediately. Thank you.
</body>
</html>