[openamq-dev] Need Big Help On OpenAMQ Callbacks

Martin Sustrik sustrik at imatix.com
Tue Aug 14 13:32:44 CEST 2007


Hi,

>     (*) I just expose my Middleware wrapper (written in C) from JNI to 
> access by the Java. It working perfectly fine. Issue is when it comes to 
> multi threading on Java we have big big issues. its not working as we 
> expected.

OpenAMQ client is not thread-safe by design. However, with the new 
release hopefully coming out this week you should be able to open 
several connections (each for one thread) and it should work fine.

Till then, I would say, synchronising accessing threads using critical 
section would do.

> Suggestion : If we can have Call back methods like in JMS we can solve 
> this problem. Even in C++ if we use multiple threads to do this it will 
> causes problems. Cas i think multiple threads cant block on queues (even 
> when there are totally different queue names).

Using callbacks instead of wait is quite a big design change and it 
doesn't solve your problem anyway. With callbacks there would be _one_ 
worker thread in OpenAMQ client that would invoke callback functions. If 
there are several threads in your Java app, you will still have to 
synchronise them with the callback thread.

Martin


More information about the openamq-dev mailing list