[openamq-dev] Multi-threaded connection requests fail?

Martin Sustrik sustrik at imatix.com
Thu Nov 8 14:07:56 CET 2007


Elli,

> Attached is a noodled-up adaptation of your amq_client.c, linked against 
> pthreads. 
> Strangely, I did have success exactly once, so I am still not sure what 
> is going on...
> 
> The problem lies on the first connection_new call.  I can't get past that.

The first connection_new works ok for me although I get 'no such queue 
defined' error later.

What exactly does connection_new return on your box? NULL?

> Further, must the thread functions declare their own private 
> connections, or may they attach their sessions
> to the process global connection established by the main function?

Connection and session objects aren't thread-safe. If you want to use 
openAMQ from 2 different threads, you should create two separate 
connections.

Martin


More information about the openamq-dev mailing list