On 06/22/2017 04:48 AM, klaus.holst.jacobsen wrote:
Hello!
I would like to send a request and get a reply from a message handlers
onMessage(...) method.
Something like this:
void MyClass::onMessage(cms::Message m)
{
cms::Destination* tempDest = session_->createTemporaryQueue();
cms::MessageConsumer* responseConsumer = session_->createConsumer(tempDest);
SomeOtherMessageHandler replyHandler;
responseConsumer->setMessageListener(&replyHandler);
cms::Message* request = session_->createTextMessage();
m->setCMSReplyTo(tempDest);
p->send(m);
...wait for response...
cms::Message* response = replyHandler.getResponse();
}
...but my code hangs in setMessageListener(...);
My guess is that because I am in the onMessage method i have locked a mutex
that is required to do setMessageHandler(...)
Is this an error or not?
In any case, what is the work-around to be able to do request/reply from a
message handler?
Do a blocking receive call instead and wait for the response that way.
Thanks in advance.
Regards
Klaus
--
View this message in context:
http://activemq.2283324.n4.nabble.com/CMS-3-9-2-process-hangs-when-calling-setMessageListener-in-onMessage-tp4727730.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
--
Tim Bish
twitter: @tabish121
blog: http://timbish.blogspot.com/