You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by David Sitsky <si...@nuix.com> on 2007/07/31 09:15:58 UTC
Embedded broker with TCP transport not message dispatching to all
consumers in round-robin fashion
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
Re: Embedded broker with TCP transport not message dispatching to all consumers in round-robin fashion
Posted by Rob Davies <ra...@gmail.com>.
yay! thx for letting us know!
cheers,
Rob
'Go Get Integrated - ride the Camel! - http://activemq.apache.org/
camel/'
http://rajdavies.blogspot.com/
On Aug 1, 2007, at 2:09 AM, David Sitsky wrote:
> Turns out this was a silly application bug - nothing to do with
> activemq after all. My apologies.
>
> Cheers,
> David
>
> David Sitsky wrote:
>> 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
Re: Embedded broker with TCP transport not message dispatching to
all consumers in round-robin fashion
Posted by David Sitsky <si...@nuix.com>.
Turns out this was a silly application bug - nothing to do with activemq
after all. My apologies.
Cheers,
David
David Sitsky wrote:
> 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