ActiveMQ NMS: connection.start() hangs with Failover protocol when broker is down

activemq-classic, apache-nms, nms

Solution

After mining google results fI found this thread

Tim Bish answered the developer there that in NMS there is a prefix transport.* that need to added to all transport properties.

my original uri was:

failover://(tcp://A,tcp://B)?randomize=true&startupMaxReconnectAttempts=1&timeout=2000

and now my URI is (pay attention on transport.* prefix):

failover://(tcp://A,tcp://B)?transport.randomize=true&transport.startupMaxReconnectAttempts=1&transport.timeout=2000

which is working and I handle the exception thrown and continue with my App.

Enjoy

Problem

I have C# application using nms.activemq 1.5.0. When my application starts it tries to connect to the broker using failover protocol (I have two brokers in master-slave configuration). If both brokers down my application is stuck in wait because of the `connection.start()`. I tried every bit of info i found on the web - I tried every attribute of the failover protocol, also tried setting the connection timeout, tried `transport.requesttimeout`. I also tried a newer version of nms.activemq, but nothing seems to solve the issue. Any idea on what can cause this problem or any workaround?

Original source