activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Mittler" <nathan.mitt...@gmail.com>
Subject Re: c++ client doesn't receive on all topic consumers
Date Thu, 25 Oct 2007 10:31:35 GMT
Which version of ActiveMQ-CPP are you using and against which ActiveMQ
broker version?  Also, platform might be helpful.


> 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.


Could it be that this first consumer was started at or after the time the
message was sent?  Consumers won't get messages they missed unless they are
retroactive consumers (http://activemq.apache.org/retroactive-consumer.html)

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.


That shouldn't be a problem.  Our example does this:
http://activemq.apache.org/cms/example.html.

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


To help isolate the problem, you might try not using selectors to see if you
get all the messages you expect.

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.


Are your java consumers using selectors as well, or do they simply receive
everything?  Also, what is the lifetime of the java consumers?  Do you
typically start them before you start the C++ consumers?

Anyone have any ideas?
>
>
> Is there a way to configure the topic for higher reliability?


I'm not convinced this is a reliability issue.  We have flooded our
consumers pretty hard in our testing.  How many messages are you sending per
second?  How many producers and consumers.  Is there just a single topic or
do you have several?

Thanks!
>

Regards,
Nate

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message