Response inlined:<div><br></div><div>-Alan<br><br><div class="gmail_quote">On Thu, Feb 16, 2012 at 7:13 AM, Eric J. Holtman <span dir="ltr">&lt;<a href="mailto:eric@holtmans.com">eric@holtmans.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I&#39;ve been hoping to get rabbitmq integrated into some<br>
of my applications. �I&#39;ve read a few books and web<br>
articles. �I&#39;ve wrangled the source into compiling and<br>
working under Windows. �The examples run fine.<br>
<br>
I&#39;m trying to figure out how to run under a multithreaded<br>
environment. �As I understood it, the whole point of having<br>
a multiplexed connection was so that I didn&#39;t have to<br>
burn an actual TCP connection for every channel.<br>
<br>
However, that doesn&#39;t seem to be how rabbitmq-c is<br>
set up.<br>
<br>
In fact, a recent question from the archives, answered<br>
by Alan says:<br>
<br>
&gt; You have interpreted the documentation correctly:<br>
&gt;<br>
&gt; amqp_connection_state_t, its socket, and all associated amqp_channel_t&#39;s<br>
&gt; must not be shared between threads. �Its ok to have separate instances of<br>
&gt; these objects used in different threads.<br>
<br>
So, if I want to consume on 4 queues, and the natural<br>
solution would be to have 4 threads doing a blocking<br>
wait (like &quot;run&quot; in the amqp_consumer example), I have<br>
to have a separate TCP connection for each one?<br></blockquote><div><br></div><div>Thats one way to do it. �Another would be to a have a &quot;connection thread&quot; that would own the non-thread-safe objects, and would dispatch the messages to the worker threads. �It takes a bit more code to accomplish it but its similar to how the Java and .NET clients work, which have a thread that handles events on a connection level, then the Channel objects associated with the Connection object can be on different threads.</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Also, I assume if I&#39;m going to use a c++ wrapper like<br>
amqpcpp or rabbitcpp I&#39;m going to have the same issue,<br>
since they&#39;re using rabbitmq-c as the lower layer?<br></blockquote><div><br></div><div>Having not used either of those C++ wrappers I believe your assumption is correct, unless the implement their own event-loop or thread that dispatches consumed messages.</div>
<div><br></div><div>As a self-less plug, if you&#39;re looking for a C++ wrapper - I&#39;d encourage you to checkout SimpleAmqpClient <a href="https://github.com/alanxz/SimpleAmqpClient">https://github.com/alanxz/SimpleAmqpClient</a>, which is Yet Another rabbitmq-c wrapper. �It won&#39;t necessarily solve your threading question though.</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks,<br>
<br>
Eric<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>
</blockquote></div><br></div>