Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-1733

RoundRobinConnectionLoadBalancingPolicy always connect to the 1st broker at startup

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • None
    • None

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            bigon Laurent Bigonville
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: