Why Connection.Start() hangs with fail-over protocol even with transport.startupMaxReconnectAttempts=1

Redan

New member
Joined
Feb 25, 2019
Messages
1
Programming Experience
1-3
I have a C# Windows service that has a consumer connected to Apache NMS.ActiveMQ, and listens for a message queue. I am handling reconnect issues when AMQ dies.
I have an issue with the scenario when my service starts while ActiveMQ. The URL looks like this:
failover://(tcp://localhost:61616)?transport.initialReconnectDelay=100&transport.startupMaxReconnectAttempts=1

I expect the behavior to be as follows:
If I start my service when ActiveMQ is down, my consumer tries to connect to ActiveMQ once (I configured it to try to connect just once in order to prevent blocking the connection.Start()), if it fails, it keeps trying to connect forever every 10 seconds (using a Timer) until ActiveMQ becomes available and the connection succeeds.

But the actual behavior is that after a couple of tries (not more than 5 times), the connection.Start() hangs and the service does not connect to ActiveMQ even if it becomes available (I printed to the log before and after connection.Start()).

The transport.startupMaxReconnectAttempts=1 should prevent the Start() from hanging forever, but it is not helping in my case.
Note: If I remove the 'transport.startupMaxReconnectAttempts=1', the connection.Start() hangs anyway, and this prevents me from stopping the service.
I tried adding transport.timeout=5000 to the URL, but the issue still occurs.

I appreciate any help you can provide
 

Latest posts

Back
Top Bottom