You can make your XMS applications to reconnect automatically following a network, queue manager or server failure. This feature is available only with WebSphere MQ V7.0 client or above. This is controlled by connection factory properties XMSC_WMQ_CLIENT_RECONNECT_OPTIONS and XMSC_WMQ_CONNECTION_NAME_LIST.
By default, XMS client applications are not automatically reconnected. Automatic reconnection is enabled by setting the property XMSC_WMQ_CLIENT_RECONNECT_OPTIONS to XMSC_WMQ_CLIENT_RECONNECT or XMSC_WMQ_CLIENT_RECONNECT_Q_MGR.
Reconnecting to a queue manager of the same name does not guarantee that you have reconnected to the same instance of a queue manager. Option XMSC_WMQ_CLIENT_RECONNECT_Q_MGR only allows reconnection to an instance of the same queue manager.
See XMSC_WMQ_CLIENT_RECONNECT_OPTIONS for details of this property.
XMS application can connect to queue manager using XMSC_WMQ_HOST_NAME and XMSC_WMQ_PORT. A new property XMSC_WMQ_CONNECTION_NAME_LIST is provided where a list of connection names can be given.
If XMS application looses connection with the server, the connections are tried in the order they are specified in the connection list until a connection is successfully established or for client reconnect timeout duration.
There is a timeout value you can configure to limit the time a client waits for reconnection. The value (in seconds) is set in CHANNELS stanza of mqclient.ini file.
CHANNELS: MQReconnectTimeout = 1800
XMS application can register an exception listener function so that it can be informed about changes in the state of reconnection. If XMS detects a problem with the connection, during reconnection, XMS calls the exception listener function passing a pointer to the context data as one parameter and the handle for an error block as the other parameter.
Errors are indicated by the error codes:
MQRC_RECONNECTING indicates connection has failed, and the system is attempting to reconnect.
MQRC_RECONNECTED indicates reconnection has been made and all handles are successfully reestablished.
For more information on exception listener functions, see Message and exception listener functions in C.
A reconnectable client is able to reconnect automatically only after connecting.