Automatic JMS client reconnection

Configure your JMS client to reconnect automatically following a network, queue manager, or server failure.

Use the CONNECTIONNAMELIST and CLIENTRECONNECTOPTIONS properties of the MQConnectionFactory class to configure a client connection to automatically reconnect following a connection failure or an administrative request to reconnect client applications after stopping a queue manager.

The full list of connection names in a connectionNameList is only accessible to the set/getconnectionNameList methods that can handle a list of connection names. Methods such as get/setHostname that do not handle lists of names, access the first name in the list.

Automatically reconnectable client connections only become reconnectable once the connection has been established.

Whether an application continues to work correctly after being reconnected automatically depends on its design. Read the related topics to understand how to design reconnectable clients. Some existing clients might work correctly without modification following automatic reconnection.

Automatic client reconnect is not supported by WebSphere® MQ classes for Java.

In order to prevent all the clients attached to a failed queue manager from reconnecting simultaneously, the reconnection attempts are delayed by intervals that are partly fixed and partly random.

By default, the reconnection attempts happen at the following intervals:
  1. The first attempt is made after an initial delay of one second, plus a random element up to 250 milliseconds.
  2. The second attempt is made two seconds, plus a random interval of up to 500 milliseconds, after the first attempt fails.
  3. The third attempt is made four seconds, plus a random interval of up to one second, after the second attempt fails.
  4. The fourth attempt is made eight seconds, plus a random interval of up to two seconds, after the third attempt fails.
  5. The fifth attempt is made 16 seconds, plus a random interval of up to four seconds, after the fourth attempt fails.
  6. The sixth attempt, and all subsequent attempts are made 25 seconds, plus a random interval of up to six seconds and 250 milliseconds, after the previous attempt fails.
This process of reconnection continues, until the client is successfully reconnected to the queue manager, or until the maximum reconnection interval elapses.

If you need to increase the default values, in order to more accurately reflect the amount of time required for the queue manager to recover, or the standby queue manager to activate, change the delay values in the MQCLIENT.INI file by using the ReconDelay attribute.