Set Reconnection Failure Parameters

EMS allows you to establish separate parameters for initial connection attempts and reconnection attempts.

How to set the initial connection attempt parameters is described in Set Connection Attempts, Timeout and Delay Parameters. This section describes the parameters you can establish for reconnection attempts following a fault-tolerant failover.

The reason for having separate connect and reconnect attempt parameters is that there is a limit imposed by the operating system to the number of connection attempts the EMS server can handle at any particular time. (For example, in Unix, this limit is adjusted by the ulimit setting.) Under normal circumstances, each connect attempt is distributed so it is less likely for the server to exceed its maximum accept queue. However, during a fault-tolerant failover, all of the clients automatically try to reconnect to the new active server at approximately the same time. When the number of connections is large, it may require more time for each client to reconnect than for the initial connect.

By default, a client will attempt reconnection 4 times with a 500 ms delay between each attempt. You can modify these settings in the factories.conf file or by means of your client connection factory API, as demonstrated by the examples in this section.

The following examples establish a reconnection count of 10, a delay of 1000 ms and a timeout of 1000 ms.

  • Java

    Use the TibjmsConnectionFactory object’s setReconnAttemptCount(), setReconnAttemptDelay(), and setReconnAttemptTimeout() methods to establish new reconnection failure parameters.

       factory.setReconnAttemptCount(10);
       factory.setReconnAttemptDelay(1000);
       factory.setReconnAttemptTimeout(1000);
  • C

    Use the tibemsConnectionFactory_SetReconnectAttemptCount, tibemsConnectionFactory_SetReconnectAttemptDelay, and tibemsConnectionFactory_SetReconnectAttemptTimeout functions to establish new reconnection failure parameters.

       status = tibemsConnectionFactory_SetReconnectAttemptCount(factory, 10);
       status = tibemsConnectionFactory_SetReconnectAttemptDelay(factory, 1000);
       status = tibemsConnectionFactory_SetReconnectAttemptTimeout(factory, 1000);
  • C#

    Use the ConnectionFactory.SetReconnAttemptCount, ConnectionFactory.SetReconnAttemptDelay, and ConnectionFactory.SetReconnAttemptTimeout methods to establish new reconnection failure parameters:

       factory.setReconnAttemptCount(10);
       factory.setReconnAttemptDelay(1000);
       factory.setReconnAttemptTimeout(1000);