Search code examples
activemq-classicmulesoftamazon-mq

Mule ActiveMQ Connector does not reconnect to Amazon MQ Load Balancer


We are in the process of migrating our message queues from an on prem solution to Amazon MQ. Our Mulesoft applications with queue listeners are unable to reconnect to the Amazon MQ load balancer URLs after weekly maintenance restarts. We did not have this problem with the on-prem ActiveMQ solution.

<jms:listener doc:name="Listener" destination="${queue.destination}" config-ref="JMS_CONFIG"/>

<jms:config name="JMS_CONFIG" doc:name="JMS Config">
    <jms:active-mq-connection username="${queue.user.name}" password="${queue.password}">
        <reconnection >
                <reconnect-forever blocking="false" frequency="15000"/>
        </reconnection>
        <jms:factory-configuration brokerUrl="${jms.broker.url}" />
    </jms:active-mq-connection>
</jms:config>

<jms.connector.version>1.7.1</jms.connector.version>
<!-- Tested version 1.7.3 as well. -->

Doesn't work:

jms.broker.url=ssl://broker-name.domain.net:61617

Work around:

jms.broker.url=failover:(ssl://worker-1.mq.us-east-1.amazonaws.com:61617,ssl://worker-2.mq.us-east-1.amazonaws.com:61617)

Is there a way to get the load balancer url working? We would prefer to have the traffic balanced between the two Amazon MQ workers.


Solution

  • Working around the issue using the failover url with the workers means that the the reconnection is delegated to the ActiveMQ JMS client implementation instead of Mulesoft. This indicates the problem is with Mulesoft's reconnection functionality somehow. Try using jms.broker.url=failover:(ssl://broker-name.domain.net:61617). That will be a better workaround as it will use the Amazon MQ load-balancer.