[openamq-dev] Get a FD from OpenAMQ

Martin Sustrik sustrik at imatix.com
Fri Jan 4 13:08:13 CET 2008


Ok,

Basically, it's simple - should be something like 100 lines of code or so.

You have to initialise a semaphore, create a socketpair and create a new 
thread. The thread should do amq_client_session_wait and once it returns 
(i.e. there are messages available) it should write one byte into the 
socketpair. Then it should wait on the semaphore. All this should be 
done in infinite loop.

In the client application you can poll on the socketpair file 
descriptor. Once the socketpair is ready for reading, it means that 
there are OpenAMQ messages available. At this moment you can get 
messages from OpenAMQ in the standard way, process them or whatever. 
Once you are ready with the processing, you should read the byte from 
the socketpair (to make it ready for polling) and post the semaphore (to 
release the OpenAMQ-checking thread). Afterwards you are free to poll 
(select) on the file descriptor.

Martin

Malinga wrote:
> Hi,
>
>  I will read those and meanwhile if you can guide me through the 
> process I may able to work around it. Since we are heavily rely on the 
> openamq we will implement this. We don't like temporary patches in our 
> apps.
>
> -Malinga
>
> ------------------------------------------------------------------------
> Never miss a thing. Make Yahoo your homepage. 
> <http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs>
> ------------------------------------------------------------------------
>
> _______________________________________________
> openamq-dev mailing list
> openamq-dev at lists.openamq.org
> http://lists.openamq.org/mailman/listinfo/openamq-dev
>   



More information about the openamq-dev mailing list