activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erngarfen <>
Subject Not receiving all msgs from queue
Date Thu, 25 Apr 2013 11:00:51 GMT
Hi all,

I've been struggling with this for a while now, but still can't get my
client to receive all the messages from a queue. I'm using ActiveMQ 5.8.0 as
the broker and ActiveMQ-CPP for the client (see simple test code below). At
the broker I have a queue filled with 1000 messages (done from a separate
python script). When I try to receive these, I usually end up with 575 or
588 received messages. Trying some combinations of 'prefetch' doesn't help
me either. If I start to acknowledge messages, I'll receive the 1000

I can see in Wireshark that 'MessagePull' is sent to the broker but the
'MessageDispatch' reply doesn't contain the 'message body'.

Any help appreciated.

#include "activemq/library/ActiveMQCPP.h"
#include "cms/ConnectionFactory.h"
#include "cms/Connection.h"
#include "cms/Session.h"

#include <iostream>

int main()
	using namespace cms;
	using namespace activemq::library;


	ConnectionFactory* lFactory	   =
	Connection*		   lConnection = lFactory->createConnection();
	Session*		   lSession	   =
	Queue*			   lQueue	   =
	MessageConsumer*   lConsumer   = lSession->createConsumer(lQueue);

	const ConnectionMetaData* lMetaData = lConnection->getMetaData();
	std::cout << "AMQ version=" << lMetaData->getProviderVersion() <<


	int lCnt = 0;
	while (true)
		if (Message* lMsg = lConsumer->receive(1000))
			std::cout << "Received msg #" << ++lCnt << std::endl;
			delete lMsg;

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message