<div class="gmail_quote">Responses inlined below:<br><br>-Alan<br><br><div class="gmail_quote"><div class="im">On Fri, Feb 10, 2012 at 2:00 PM, Arun Chandrasekaran <span dir="ltr">&lt;<a href="mailto:visionofarun@gmail.com" target="_blank">visionofarun@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br><br>With rabbitmq-c, it is possible to bind on different channels from different threads?<br>

<br>Basically, I&#39;m not sharing any of these between the threads: amqp_connection_state_t, socket, channel.<br></blockquote></div><div><br>You have interpreted the documentation correctly:<br>
<br>
amqp_connection_state_t, its socket, and all associated amqp_channel_t&#39;s must not be 
shared between threads.� Its ok to have separate instances of these objects used in different threads.<br><br></div><div class="im"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>Here is the &quot;examples/amqp_consumer.c&quot; sample code modified for 2 threads: <a href="http://codepad.org/zPa91lbr" target="_blank">http://codepad.org/zPa91lbr</a>. I have also attached the code for your reference.<br>

<br>I get this error from the second thread : <br><br>&quot;Declaring queue: server connection error 504, message: CHANNEL_ERROR - expected &#39;channel.open&#39;&quot;<br></blockquote></div><div>Your problem is on line 156:<br>

amqp_channel_open(conn, 1); /* opens channel 1 */ <br><br>You then try to use channel stored in the variable chan on line 160:<br>... = amqp_queue_declare(conn, chan /* may not be channel 1 */ ...);<br><br>Try changing 156 to open channel stored in chan.<br>

<br>Also note that channels are on a per-connection basis, so it is ok to have two different connections with the same channel identifiers.<br><br></div><div class="im"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>The README clearly states that it is valid to have different connections, sockets and channels per thread (last section): <a href="http://hg.rabbitmq.com/rabbitmq-c/file/fb6fca832fd2/README" target="_blank">http://hg.rabbitmq.com/rabbitmq-c/file/fb6fca832fd2/README</a><br>

</blockquote></div><div><br>Just an FYI: the canonical sources for the rabbitmq-c library have moved to a new location:<br><a href="https://github.com/alanxz/rabbitmq-c" target="_blank">https://github.com/alanxz/rabbitmq-c</a><br>
�<br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">
<br>Can someone give me an insight into where I am going wrong or if it is a limitation with rabbitmq-c?<br><br>Cheers,<br>Arun<br><br></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>
</div><br>