Hello,

since there seems to be no method in the C++ messaging API to listen on two different message brokers at the same time I will do this using two additional threads. So I ask myself how threadsafe the messaging API is or more concrete: how threadsafe the method "qpid::messaging::Session::nextReceiver()" is.

My plan is to use the main thread to read and send messages from/to both of the brokers.

For waiting on incoming messages I start two additional threads. Each of them calls Session::nextReceiver(). If a message is available the main thread will be informed and call fetch() on the receiver which woke up.

My question is: Would it be a problem if one thread calls session.nextReceiver() and at the same time another thread calls receiver.fetch()?

It could also be possible that the main thread calls sender.send() while the other thread is waiting in session.nextReceiver()?

Do you see any problems there?

Regards,
Andreas



On 07/21/2015 10:15 AM, Andreas Welchlin wrote:
Hello,

I wrote an application which reads from two different message brokers.

So I used two connections and therefore I got also two sessions.

When I have just one session I can just call "qpid::messaging::Session::nextReceiver()". But this is not possible with two sessions. I could call nextReceiver for both sessions in two differnt threads but this is not so nice.

Do you have an idea how I could solve this in an easy way?

Regards,
Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to