Use automatic client reconnection in Java SE environments

Applications using the IBM MQ classes for JMS running in Java SE environments can use the automatic client reconnection functionality through the connection factory property CLIENTRECONNECTOPTIONS.

The connection factory property CLIENTRECONNECTOPTIONS uses two additional connection factory properties, CONNECTIONNAMELIST and CCDTURL, to determine how to connect to the server on which the queue manager is running.


CONNECTIONNAMELIST property

The CONNECTIONNAMELIST property is a comma-separated list that contains the host name and port information to be used to connect to a queue manager in client mode. This property is used with the QMANAGER and CHANNEL values. When an application uses the CONNECTIONNAMELIST property to create a client connection, the IBM MQ classes for JMS try to connect to each host in list order. If the first queue manager host is unavailable, the IBM MQ classes for JMS attempt to connect to the next host on the list. If the end of the connection name list is reached without creating a connection, the IBM MQ classes for JMS throw the MQRC_QMGR_NOT_AVAILABLE IBM MQ reason code.

If the queue manager that the application is connected to fails, any applications that used a CONNECTIONNAMELIST to connect to that queue manager receive an exception indicating the queue manager is not available. The application must catch the exception and clear any resources that it was using. To create a connection, the application must use the connection factory. The connection factory attempts to connect to each host in list order again, the queue manager that failed is now not available. The connection factory attempts to connect to another host in the list.


CCDTURL property

The CCDTURL property contains a Uniform Resource Locator (URL) that points to a Client Channel Definition Table (CCDT), this property is used with the QMANAGER property. The CCDT contains a list of client channels that are used to connect to a queue manager defined on an IBM MQ system. For information on how CCDTs are used by the IBM MQ classes for JMS, see Use a client channel definition table with IBM MQ classes for JMS.


Use the CLIENTRECONNECTOPTIONS property to enable automatic client reconnection within the IBM MQ classes for JMS

The CLIENTRECONNECTOPTIONS property is used to enable automatic client reconnection within the IBM MQ classes for JMS. The possible values for this property are as follows:

    ASDEF
    The automatic client reconnection behavior is defined by the default value that is specified in the channel stanza of the IBM MQ client configuration file (mqclient.ini).

    DISABLED
    Automatic client reconnection is disabled.

    QMGR
    The IBM MQ classes for JMS attempt to connect to a queue manager with the same queue manager identifier as the queue manager that it was connected to, using either of the following options:

    • The CONNECTIONNAMELIST property and the channel that is defined in the CHANNEL property.
    • The CCDT defined in the CCDTURL property.

    ANY
    The IBM MQ classes for JMS attempt to reconnect to a queue manager of the same name with the use of either the CONNECTIONNAMELIST property or the CCDTURL.

Parent topic: Use automatic client reconnection in Java SE and Java EE environments


Related information