activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott the Red <>
Subject c++ client doesn't receive on all topic consumers
Date Thu, 25 Oct 2007 06:48:36 GMT

I'm creating a C++ adapter class to represent a message consumer connecting
to ActiveMQ.

Unfortunately, the consumers are not reliably receiving messages.  Some
receive OK, but others have a problem where the first consumer of a
particular message doesn't receive.  However, any additional consumers of
the same type do.

I also see that a process sending a message in one thread won't receive the
message in another thread.  The sender and consumer use different
connections, and the consumer's "noLocal" is false.

The consumers are listening on topics using message selectors.  The topics
and connection have no special configuration. 

The adapter is based on the "standard" example at

The connection code looks like this (mostly it's just a copy of the

void MyConsumer::start()

	std::string brokerURI =

        // Create a ConnectionFactory
       	ActiveMQConnectionFactory* connectionFactory =
	           new ActiveMQConnectionFactory( brokerURI );

        // Create a Connection
       	connection = connectionFactory->createConnection();
        delete connectionFactory;


        // Create a Session
        session = connection->createSession( Session::AUTO_ACKNOWLEDGE );

        // Create the destination (Topic or Queue)
        if( useTopic ) {
            destination = session->createTopic( this->destinationName );
        } else {
            destination = session->createQueue( this->destinationName );

	// create a message selector:
        std::stringstream selector;
        selector << "messageType='" << this->messageType << "'";

        // Create a MessageConsumer from the Session to the Topic or Queue
        consumer = session->createConsumer( destination, selector.str() );

        consumer->setMessageListener( this );

        // Indicate we are ready for messages.

/*virtual*/ void onMessage( const Message* message ) 

Debugging and output show that onMessage() is never called for the
non-receiving consumers.

Java-based processes show that the input messages are being sent correctly.

Anyone have any ideas?

Is there a way to configure the topic for higher reliability?


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

View raw message