You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by mariancristian <ci...@yahoo.com> on 2016/09/16 11:30:59 UTC
ActiveMQ QueueBrowser returns NULL
Hi,
I am trying to implement a queue browser and parse the messages in that
queue. Here is my sample code:
std::unique_ptr<cms::Queue>
destination(cmsSess->createQueue("TEST.FOO"));
cms::MessageProducer* producer =
cmsSess->createProducer(destination.get());
producer->setDeliveryMode(cms::DeliveryMode::NON_PERSISTENT);
sendTestMsg(producer, cmsSess); // this is a function that sends three text
messages to the queue
// after this point,
I can see the messages in the AMQ web
// console
std::unique_ptr<cms::QueueBrowser> browser(
cmsSess->createBrowser(destination.get()) );
cms::MessageEnumeration* enumeration = browser->getEnumeration();
while (enumeration->hasMoreMessages())
{
std::auto_ptr<cms::Message> inbound(enumeration->nextMessage());
}
The sample code will never leave the 'while' loop and inbound message will
be NULL.
Can you please tell me if I am using the Queue Browser in a wrong way?
Thanks,
Marian
--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-QueueBrowser-returns-NULL-tp4716591.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.