We are using Apache ActiveMQ 5.5. We have a broker (let's call it the main broker) that runs on tcp: //0.0.0.0: 61616. This broker sends and sends a message to a remote broker. To do this, we have a network connection from this broker to two remote brokers. We want one of the remote brokers to serve as the primary and the other to be fault tolerant. This is the URI of the network connection that we are using
static:(failover://(tcp://<b>server1</b>:61617,tcp://<b>server2</b>:61617)?randomize=false)
We use spring DefaultMessageListenerContainer to listen for messages
failover://(tcp://<b>server1</b>:61617,tcp://<b>server2</b>:61617)?randomize=false
In the usual scenario, when all brokers are started and a message is sent to the main broker, it is sent to server1 and consumed by the listener.
If we stop the broker on server1, the failure will succeed, and messages will be sent to server2 and successfully used by the listener. The problem is that when we return server 1, messages continue to be forwarded by the main broker to server2. Our requirement is that as soon as server 1 is up and running, the Main Broker should start sending messages to server1, and the listener should connect to server1 and use messages. We cannot change randomize to true because we want only one of server1 or server2 to be active at a time.
Please let me know if and how.
source share