Yep, I have been trying with that doc but I can&#39;t make it work.<div><br></div><div>RPC_SERVER is working good.</div><div>My problem comes with the RPC_CLIENT.</div><div><br></div><div>I am still trying, but i can&#39;t figure it out...</div>

<div><br></div><div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)">#!/usr/bin/env python</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)">import pika</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)">import uuid</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><br></font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)">class FibonacciRpcClient(object):</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">        </span>def __init__(self):</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span># self.connection = pika.BlockingConnection(pika.ConnectionParameters(</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span># <span class="Apple-tab-span" style="white-space:pre">                </span>host=&#39;localhost&#39;))</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span><font color="#009900">print &#39;init---&#39;</font></font></b></div><div>

<b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><br></font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>self.parameters = pika.ConnectionParameters(host=&#39;localhost&#39;)</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span><font color="#009900">print &#39;self.parameters =&#39;,self.parameters</font></font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span># self.connection = pika.SelectConnection(parameters, on_connected)</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>self.connection = pika.SelectConnection(self.parameters)</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span><font color="#009900">print &#39;self.connection =&#39;,self.connection</font></font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><br></font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span># self.channel = self.connection.channel(self.on_channel_open)</font></b></div>

<div><span class="Apple-tab-span" style="white-space:pre;background-color:rgb(153,153,153)"><b><font face="arial black, sans-serif">                </font></b></span></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">        </span># Step #3</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">        </span>def on_channel_open(self,new_channel):</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>&quot;&quot;&quot;Called when our channel has opened&quot;&quot;&quot;</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span># self.channel = new_channel</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span><font color="#990000">print &#39;on_channel_open...&#39;</font></font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>result = self.channel.queue_declare(exclusive=True)</font></b></div><div>

<b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span><font color="#990000">print &#39;result =&#39;,result</font></font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>self.callback_queue = result.method.queue</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><br>

</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>self.channel.basic_consume(self.on_response, no_ack=True,</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                                                                </span>   queue=self.callback_queue)</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><br>

</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">        </span>def open_connection(self):</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>print &#39;open_connection&#39;</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>self.channel = self.connection.channel(self.on_channel_open)</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>print &#39;self.channel =&#39;,self.channel</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><br>

</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><br></font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">        </span>def on_response(self, ch, method, props, body):</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>if self.corr_id == props.correlation_id:</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                        </span>self.response = body</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><br></font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">        </span>def call(self, n):</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>self.response = None</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>self.corr_id = str(uuid.uuid4())</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>self.channel.basic_publish(exchange=&#39;&#39;,</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                                                                </span>   routing_key=&#39;rpc_queue&#39;,</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                                                                </span>   properties=pika.BasicProperties(</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                                                                                </span> reply_to = self.callback_queue,</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                                                                                </span> correlation_id = self.corr_id,</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                                                                                </span> ),</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                                                                </span>   body=str(n))</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>while self.response is None:</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                        </span>self.connection.process_data_events()</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><span class="Apple-tab-span" style="white-space:pre">                </span>return int(self.response)</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)"><br></font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)">fibonacci_rpc = FibonacciRpcClient()</font></b></div>

<div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)" color="#006600">print &#39;FibonacciRpcClient created&#39;</font></b></div><div><b><font face="arial black, sans-serif" style="background-color:rgb(153,153,153)">fibonacci_rpc.open_connection()</font></b></div>

</div><div><br></div><div>I never get to see the <span style="background-color:rgb(204,0,0)"><b>RED </b></span>prints... :(</div><div>I see all <span style="background-color:rgb(0,153,0)"><b>GREEN </b></span>prints</div>
<div>
<br></div><div>Until I get this right I can&#39;t start with the ioloop.... correct?</div><div><br></div><div>Thanks Gavin.</div><div><br></div><div><br><br><div class="gmail_quote">2012/11/21 Gavin M. Roy <span dir="ltr">&lt;<a href="mailto:gmr@meetme.com" target="_blank">gmr@meetme.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You are correct, SelectConnection is an async adapter. Check out<div><br></div><div><a href="http://pika.readthedocs.org/en/latest/connecting.html" target="_blank">http://pika.readthedocs.org/en/latest/connecting.html</a><br>

<div class="gmail_extra">

<br></div><div class="gmail_extra">And see if it helps.</div><div class="gmail_extra"><br>Regards,</div><div class="gmail_extra"><br>Gavin<br><br><div class="gmail_quote"><div><div class="h5">On Wed, Nov 21, 2012 at 7:14 AM, Gonzalo Fernandez <span dir="ltr">&lt;<a href="mailto:dvittomc@gmail.com" target="_blank">dvittomc@gmail.com</a>&gt;</span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5">Hi!<div><br></div><div>I have been working with RabbitMQ for over 6 months now I have just recently found a new Connection Type.</div>



<div><br></div><div>Before, I only used BlockingConnection. Now I found SelectConnection and I think it fits better for me.</div>

<div>Async right?</div><div><br></div><div>Anyway, I am trying to make a small RPC example such as the one on the tutorial but I am kind of stucked.</div><div><br></div><div>I could use some help if you don&#39;t mind.</div>





<div><br></div><div>I am trying to understand the ioloop.start() and how does a queue consume its elements.</div><div><br></div><div>Everything is different (or it looks like it) with this form of connection.</div><div><br>





</div><div>Any suggestions? Am I making it harder that it really is?</div><div><br></div><div>I am a little ashamed of myself, but I can&#39;t figure it out.</div><div><br></div><div>Thanks in advance.</div><div><br></div>





<div>patpat ---</div>
<br></div></div>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>







<p><span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Gavin M. Roy</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">

<span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">Chief Technology Officer</span><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">

</p><blockquote style="padding-left:1ex;border-left-color:rgb(204,204,204);color:rgb(34,34,34);border-left-style:solid;font-size:13px;margin:0px 0px 0px 0.8ex;font-family:arial,sans-serif;border-left-width:1px">

</blockquote><a href="http://www.meetme.com/" style="color:rgb(17,85,204);font-size:13px;font-family:arial,sans-serif" target="_blank"><img src="http://movies.myyearbook.com/emailsignatureimages/logo2.png"></a><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">



<font color="#666666" style="font-size:13px;font-family:arial,sans-serif">100 Union Square Drive<br>New Hope, PA 18938<br>p. <a href="tel:%2B1.215.862.1162%20x263" value="+12158621162" target="_blank">+1.215.862.1162 x263</a><br>

f. <a href="tel:%2B1.215.862.0465" value="+12158620465" target="_blank">+1.215.862.0465</a></font><p></p><p><a href="https://www.facebook.com/pages/MeetMe/21931227129" style="color:rgb(17,85,204);font-size:13px;font-family:arial,sans-serif" target="_blank"><img src="http://movies.myyearbook.com/emailsignatureimages/fb_mini.gif"></a><span style="color:rgb(136,136,136);font-size:13px;font-family:arial,sans-serif"> </span><span style="color:rgb(136,136,136);font-size:13px;font-family:arial,sans-serif"> </span><span style="color:rgb(136,136,136);font-size:13px;font-family:arial,sans-serif"> </span><a href="https://twitter.com/meetme" style="color:rgb(17,85,204);font-size:13px;font-family:arial,sans-serif" target="_blank"><img src="http://movies.myyearbook.com/emailsignatureimages/tw_mini.gif"></a><span style="color:rgb(136,136,136);font-size:13px;font-family:arial,sans-serif"> </span><span style="color:rgb(136,136,136);font-size:13px;font-family:arial,sans-serif"> </span><span style="color:rgb(136,136,136);font-size:13px;font-family:arial,sans-serif"> </span><a href="http://www.youtube.com/user/MeetMeVideos" style="color:rgb(17,85,204);font-size:13px;font-family:arial,sans-serif" target="_blank"><img src="http://movies.myyearbook.com/emailsignatureimages/yt_mini.gif"></a><br style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">



<font color="#888888" style="font-size:13px;font-family:arial,sans-serif"><br></font><font color="#666666" style="font-size:13px;font-family:arial,sans-serif"><font>The public market leader in social discovery. </font><font>(NYSE MKT: MEET)</font> </font></p>



<br>
</div></div>
<br>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div><br></div>