WebSphere Message Service Client for C/C++, Version 2.0.2 Operating Systems: AIX, Linux, Solaris, Windows

Automatic WMQ client reconnection through XMS

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.

XMSC_WMQ_CLIENT_RECONNECT_OPTIONS

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.

XMSC_WMQ_CONNECTION_NAME_LIST

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
Note: No reconnection attempts are made after the timeout has expired. The default value is 1800 seconds (30 minutes). See XMSC_WMQ_CONNECTION_NAME_LIST property for details.

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.

Note: Some restrictions apply during reconnection. When a client reconnection occurs, the XMS operation will pause. Depending on the nature of the XMS session, it may be that subsequent commits or message acknowledges would fail and need to be retried. An application should be written to handle this.

Concept topic

Terms of Use | Rate this page

Last updated: 24 May 2011

(C) Copyright IBM Corporation 2005, 2011. All Rights Reserved.