Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does failover transport do with a single URI

Tags:

activemq

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

like image 226
matt helliwell Avatar asked Jun 21 '13 19:06

matt helliwell


People also ask

How does ActiveMQ failover work?

The Failover transport randomly chooses one of the composite URIs and attempts to establish a connection to it. If it does not succeed, or if it subsequently fails, a new connection is established choosing one of the other URIs randomly from the list.

What is ActiveMQ transport connector?

The VM transport allows clients to connect to each other inside the VM without the overhead of the network communication. The connection used is not that of a socket connection but instead uses direct method invocations to enable a high performance embedded messaging system.

What is ActiveMQ broker URL?

The Broker URI allows you to run a configured broker using a single URI for all the configuration.

Does ActiveMQ use HTTP?

ActiveMQ implements a RESTful API to messaging which allows any web capable device to publish or consume messages using a regular HTTP POST or GET.


2 Answers

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.

like image 190
Hiram Chirino Avatar answered Oct 10 '22 18:10

Hiram Chirino


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.

like image 45
anubhava Avatar answered Oct 10 '22 18:10

anubhava