Search code examples
jmsactivemq-classicspring-jms

ActiveMQ rebalanceClusterClients not working with Spring Boot JMS


We are using the Spring JmsTemplate implementation with a CachingConnectionFactory. We have configured the connection with a failover-url:

failover:(ssl://172.16.0.11:61616,ssl://172.16.0.12:61616)?maxReconnectDelay=2000

On the transport connector in ActiveMQ we have enabled the option "rebalanceClusterClients":

        <transportConnector name="openwire" uri="ssl://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600" rebalanceClusterClients="true">
            <publishedAddressPolicy>
                <publishedAddressPolicy publishedHostStrategy="IPADDRESS" />  
            </publishedAddressPolicy>
        </transportConnector>

However, all of the clients are connecting to the first broker in the list of brokers instead of some of them being rebalanced to the second broker.

Previously we did not use the Spring JMS implementation, but instead we used the ActiveMQ libraries directly. This implementation did allow rebalancing the connected clients.

Is something in Spring preventing the rebalancing? Perhaps the CachingConnectionFactory?

EDIT 2019-07-10

I've found these two (p1 and p2) posts on SO where it is stated that CachingConnectionFactory doesn't play nicely with the failover-protocol. However, I think this has been resolved since then as we do see the connections moving between brokers if a broker is turned off.

What we do not see is connections being balanced across brokers. We did see this behavior when we were still using our own custom JMS implementation. So might it be something in Spring or the JmsTemplate?


Solution

  • The actual problem was not ActiveMQ or Spring rather an external firewall prevented this from working.