activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaklug <>
Subject Multiple consumers not working with 1.6.2
Date Thu, 30 Jan 2014 20:45:09 GMT
I'm using the Apache.NMS driver 1.6.2.  I want to have multiple consumers
receive message from a queue either in a round-robin fashion or based on the
prefetch value.  Regardless of what I set for the delivery policy or the
prefetch value, I can only get one consumer to receive messages.  Here is my
consumer code:

            const string _queue =

            const string _connString =

            System.Uri connecturi;
            IConnection connection;
            ISession session;
            IMessageConsumer consumer;
            MessageListener receiveMessageListener;

            connecturi = new Uri(_connString);
            Console.WriteLine("Cconnecting to " + connecturi);

            IConnectionFactory factory = new
            connection = factory.CreateConnection();

            session =
            var destination = session.GetQueue(_queue);
            consumer = session.CreateConsumer(destination);
            receiveMessageListener = new MessageListener(OnMessage);
            consumer.Listener += receiveMessageListener;

My event handler:

        public static void OnMessage(IMessage imessage)
            Console.WriteLine("Received message");

I've tried different values for prefetch.  I've also tried modifying the
code to use consumer.Receive(timeout).  Even with this approach I only have
one consumer receiving messages.  Can you please tell me what I'm doing
wrong?  Is this a bug?  Seems like this should work without much effort.

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

View raw message