activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zielin <pa...@zielin.pl>
Subject Asynchronous consumer
Date Thu, 12 Dec 2013 22:11:21 GMT
Hello,

I'm writing library in QT C++ which wraps ActiveMQ CMS API and allows using
activemq without including any cms api headers etc. I have written
synchronous consumer and producer. Everything works fine until I create two
synchronous consumers consuming messages in separate threads. For example:
    Consumer c1;
    c1.topic = "test";
    c1.start(); -- starts thread 1

    c1.sleep(2);

    Consumer c2;
    c2.topic = "test2";
    c2.start(); -- starts thread 2

Code above should create two consumers working separately but in the end,
works only c2, and it consumes messages. Consumer c1 is totally suspended
and never exits from cms::MessageConsumer::receive method.

Consumers are created in threads, they doesn't share sessions. I haven't
implemented consumers as messagelisteners because I wanted to avoid
including ActiveMQ header files in my declaration file. I want to create
fully functional library for QT which allows using activemq. It works fine
for one consumer :/. 

Can You help me solve problem of locked first consumer. Is there possibility
using synchronous consumers in separated threads independently ?

When I have two producers there is no problem. They can produce messages and
there is no deadlocks.

Thanks.




--
View this message in context: http://activemq.2283324.n4.nabble.com/Asynchronous-consumer-tp4675496.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message