activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott the Red <scott_sa...@yahoo.com>
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
http://activemq.apache.org/cms/example.html



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

void MyConsumer::start()
{

	std::string brokerURI =
	        "tcp://127.0.0.1:61616"
        	"?wireFormat=openwire"
	        "&transport.useAsyncSend=true";


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

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

        connection->setExceptionListener(this);

        // 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.
        latch.countDown();
}

/*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?


Thanks!





-- 
View this message in context: http://www.nabble.com/c%2B%2B-client-doesn%27t-receive-on-all-topic-consumers-tf4688946s2354.html#a13401180
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message