I am currently using NMS (C#), and I provide it with three server addresses with a priority server with the expectation for it to connect to the 2nd or 3rd server when the main is offline and then re-connect with the main server once back online.
I am using the following nugets:
- Apache.NMS.ActiveMQ (1.8.0)
- Apache.NMS (1.8.0)
- Broker version 5.16.4 (I think)
Connection string:
failover:(tcp://mainServer:61619,tcp://backup1:61619,tcp://backup2:61619)?randomize=false&timeout=10000&backup=true&priorityBackup=true&useExponentialBackOff=true&reconnectDelayExponent=2.0&initialReconnectDelay=5000&initialReconnectDelay=180000&consumerExpiryCheckEnabled=false
When the main server goes offline, I expect it to trigger an event to state that it is switching. Is there any way to detect when it switches back and forth between servers?