Reputation: 2678
In my ActiveMQ client when I specify which broker to which to connect, what's the difference between specifying
tcp://host:port
and
failover:(tcp://host:port)
I've tried stopping and starting the broker and in both cases the client finds the broker again when it restarts. I haven't experimented with messages in flow (I'm using queues) or other network failures yet to see if there is a difference.
Hopefully someone has a definitive answer as the documentation I've found is a bit vague.
Thanks
Upvotes: 5
Views: 5556
Reputation: 89
Failover is very useful to deal with the problem of broker or system failure and provides durability.
failover:(tcp://host1:port,tcp://host2:port,tcp://host3:port)?jms.useAsyncSend=true&randomize=false
Here if you make randomize = true, then it will use all 3 brokers simultaneously and randomize = false means use one broker at a time and when the running broker goes down, pick any broker from the sleeping brokers. And useAsyncSend = true will run the messaging system in asynchronous manner which is fast as compared to synchronous.
Upvotes: 1
Reputation: 785128
failover protocol also lets you provide some useful connection parameters. For ex:
failover:(tcp://host:port)?jms.useAsyncSend=true&timeout=5000
Here timeout=5000
will make sure to bail out initial connection attempt after 5 sec if broker isn't available or not responding.
Upvotes: 2
Reputation: 4091
If you use failover, then the client library go into a reconnect loop when you loose connection to the server. The network failure will be hidden from your app. If you don't use failover, then when you loose your connection then your app will get a JMS error telling you you lost the connection.
Upvotes: 5