activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Sitsky <s...@nuix.com>
Subject Embedded broker with TCP transport not message dispatching to all consumers in round-robin fashion
Date Tue, 31 Jul 2007 07:15:58 GMT
Hi,

I am sure this is a silly configuration issue on my part, but I can't 
figure it out.

I am using activemq 4.1.1 on Vista.  I basically have two queues, one 
called submitted-items, and another called completed-items.

JVM1 takes items from completed-items, and does some work with them. 
This JVM also runs the embedded broker with a TCP connector.  I have a 
configurable number of sessions sharing the same connection which 
performs this work.

In JVM2, I have a worker process which take items from the 
submitted-items queue, and potentially generate new messages on both the 
submitted-items and completed-items queue.  There is also a configurable 
number of sessions sharing the same connection which performs this work.

This all works fine, regardless if JVM1 and JVM2 are on the same machine 
or not.

If I try to run JVM3, which runs the same code as JVM2, while I can see 
it connects to the broker (confirmed with debug), it receives no 
notifications for items on the submitted-items queue.

If I kill JVM2, then JVM3 immediately receives new message notifications.

If I start up JVM2 again, it sits there receiving no new messages.  If I 
kill JVM3, then JVM2 starts to receive messages again.

So connectivity works - but somehow during message dispatch, only one 
JVM (connection) is being selected for items in submitted-items queue.

I have set all prefetch limits to 1, and have created the broker as follows:

BrokerService broker = new BrokerService();
broker.setPersistent(false);
broker.setUseJmx(false);
broker.deleteAllMessages();
broker.addConnector(CONNECTION_URL);
broker.start();

Connections for all JMS clients are created like:

ActiveMQConnectionFactory connectionFactory =
           new ActiveMQConnectionFactory(CONNECTION_URL);
ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
prefetchPolicy.setAll(1);
connectionFactory.setPrefetchPolicy(prefetchPolicy);
Connection connection = connectionFactory.createConnection();
connection.start();

All messages are received using the onMessage() style.

I know I probably haven't posted enough code - but is there an obvious 
reason why this might be happening?  Thanks in advance.

-- 
Cheers,
David

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://www.nuix.com                            Fax: +61 2 9212 6902

Mime
View raw message