How can I support auto reconnection?

Networks are unreliable and sockets do get dropped from time to time (it could be a network glitch, dodgy router, firewall, or someone could even just restart a broker).

You often want a JMS client to automatically handle the fact that the connection to the broker was lost such that the JMS client either reconnnects to the same broker when it becomes available, or reconnects to another broker in the cluster.

Its easy to perform auto-reconnection. In Apache ActiveMQ using the failover transport in which the JMS client (connection) will automatically reconnect to the broker if there is a socket exception.

Just use the following connection URI (setting the brokerURL in the ActiveMQConnectionFactory)

You can use a list of URIs to specify which machines to connect to and use discovery to find the brokers to connect to. More details on this see Configuring Transports

© 2004-2011 The Apache Software Foundation.
Apache ActiveMQ, ActiveMQ, Apache, the Apache feather logo, and the Apache ActiveMQ project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram