KB Article #180587

JMS connection to ActiveMQ cluster, issue with failover transport

Problem

  • How to correctly use ActiveMQ Failover Transport for an HA connection to an ActiveMQ cluster of two or more brokers.
  • JMS external connection using ActiveMQ tcp://host:port syntax does not fail over when that broker is down.
  • Using failover:(tcp://host1:port,tcp://host2:port) syntax can cause deployments to fail and instances to lockup.
  • Interaction between ActiveMQ failover transport and API GW settings 'Automatic reconnection' or 'Start first connection asynchronously'.
  • Keywords: ActiveMQ, Broker cluster, Failover transport, instance lockup, fail to deploy, port 61616

Resolution

This article refers to the ActiveMQ failover transport, documented here: Link

The failover transport has a known behavior where it can wait indefinitely for a host to become available, issue also observed with some JMS URL syntax errors. As a result, this can block API GW JMS threads that in turn can interfere with runtime traffic, instance restart due to a deployment, or instance startup.

The resolution is to provided two additional parameters that will cause the failover transport to return control back API GW in such conditions. Then, if enabled, the existing API GW JMS settings 'Automatic reconnection' or 'Start first connection asynchronously' will take over and work as they do with the normal tcp://host:port transport. i.e. the JMS connection will be retried again later, or startup should continue.

Please make sure you include settings maxReconnectAttempts and startupMaxReconnectAttempts with 1 or a low number in order to prevent blocking behavior.

example: failover:(tcp://host1:61616,tcp://host2:61616)?maxReconnectAttempts=1&startupMaxReconnectAttempts=1