[ 
https://issues.apache.org/jira/browse/ARTEMIS-1733?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Laurent Bigonville updated ARTEMIS-1733:
----------------------------------------
    Description: 
Hi,

When using the client-side-load-balancing from apache activemq artemis examples 
on my own setup (2 RH amq) I see that the first connection is always going to 
the same broker. The documentation says that 
RoundRobinConnectionLoadBalancingPolicy should 1st pick up a random broker and 
then do round-robin, but that 1st step doesn't seems to work.

I've the the following string in the jndi.properties and starting the example 
with mvn -PnoServer verify:

java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
connectionFactory.ConnectionFactory=tcp://foo.example.com?user=user;password=password
queue.queue/exampleQueue=exampleQueue

Adding some printnl() in the select() function of 
RoundRobinConnectionLoadBalancingPolicy, I see that pos = 
RandomUtil.randomInterval(0, max); is being called with max value of 1 the 1st 
time(should be 2 as there are two servers). The subsequent calls to that 
functions show that max value is then set to 2 as expected.

This explains why I always get my applications to connect to the same broker.

  was:
Hi,

When using the client-side-load-balancing from apache activemq artemis examples 
on my own setup (2 RH amq) I see that the first connection is always going to 
the same broker. The documentation says that 
RoundRobinConnectionLoadBalancingPolicy should 1st pick up a random broker and 
then do round-robin, but that 1st step doesn't seems to work.

I've the the following string in the jndi.properties and starting the example 
with mvn -PnoServer verify:

{{java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory}}
{{ 
connectionFactory.ConnectionFactory=tcp://foo.example.com?user=user;password=password}}
{{ queue.queue/exampleQueue=exampleQueue}}

Adding some printnl() in the select() function of 
RoundRobinConnectionLoadBalancingPolicy, I see that pos = 
RandomUtil.randomInterval(0, max); is being called with max value of 1 the 1st 
time(should be 2 as there are two servers). The subsequent calls to that 
functions show that max value is then set to 2 as expected.

This explains why I always get my applications to connect to the same broker.


> RoundRobinConnectionLoadBalancingPolicy always connect to the 1st broker at 
> startup
> -----------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-1733
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1733
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Laurent Bigonville
>            Priority: Major
>
> Hi,
> When using the client-side-load-balancing from apache activemq artemis 
> examples on my own setup (2 RH amq) I see that the first connection is always 
> going to the same broker. The documentation says that 
> RoundRobinConnectionLoadBalancingPolicy should 1st pick up a random broker 
> and then do round-robin, but that 1st step doesn't seems to work.
> I've the the following string in the jndi.properties and starting the example 
> with mvn -PnoServer verify:
> java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
> connectionFactory.ConnectionFactory=tcp://foo.example.com?user=user;password=password
> queue.queue/exampleQueue=exampleQueue
> Adding some printnl() in the select() function of 
> RoundRobinConnectionLoadBalancingPolicy, I see that pos = 
> RandomUtil.randomInterval(0, max); is being called with max value of 1 the 
> 1st time(should be 2 as there are two servers). The subsequent calls to that 
> functions show that max value is then set to 2 as expected.
> This explains why I always get my applications to connect to the same broker.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to