Search code examples
activemq-classic

ActiveMQ Classic Failover configuration


Our API can send messages to our workerhost service using ActiveMQ.

activemq:failover:(tcp://brokera.domain.net:21249,tcp://brokerb.domain.net:21249)?maxReconnectAttempts=2&timeout=3000&initialReconnectDelay=2000
activemq:failover:(tcp://brokera.domain.net:21249,tcp://brokerb.domain.net:21249)?transport.maxReconnectAttempts=2&transport.timeout=3000&initialReconnectDelay=2000

We seem to be using the above URLs somewhat interchangeably. Note that the 2nd specifies the transport schema for two of the params. As far as we're able to tell, this has been working as expected in production, but admittedly, we hope that we've never really needed the failover!

I've done some testing (by manually stopping ActiveMq across the LB nodes) and the failover seems to work as expeced with both configs.

However, ActiveMQ don't say that the maxReconnectAttempts and timeout should be prefixed with transport, thus our initial concern was that they're not working as expected. See here

Even more confusing, is that the ActiveMQ docs for TCP transport, say that client connections must ommit the transport schema. And even then, the two properties I mention above aren't in the list of supported params. See here

We're looking to find out which is the correct connection string we should be using. Optionally, a way to better test or ensure that those params are being used would be very useful.

Edit: We're using the .NET Core 6 client Apache.NMS.ActiveMQ version 1.8.0. Broker version 5.13.2


Solution

  • The linked documentation is for the Java JMS client which does not operate the same way when parsing the URI options as the NMS Openwire client so you need to reference the client documentation here.

    From what I see in the NMS client documentation the transport options must be prefixed with the 'transport.' tag in order for the client to parse them out of the URI.