activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mariancristian <cincamar...@yahoo.com>
Subject ActiveMQ QueueBrowser returns NULL
Date Fri, 16 Sep 2016 11:30:59 GMT
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.

Mime
View raw message