Set Connection Attempts, Timeout and Delay Parameters

By default, a client will attempt to connect to the server two times with a 500 ms delay between each attempt.

A client can modify this behavior by setting new connection attempt count and delay values. There are also a number of factors that may cause a client to hang while attempting to create a connection to the EMS server, so you can set a connection timeout value to abort a connection attempt after a specified period of time. For best results, timeouts should be at least 500 milliseconds. EMS also allows you to establish separate count, delay and timeout settings for reconnections after a fault-tolerant failover, as described in Set Reconnection Failure Parameters.

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

  • Java

    Use the TibjmsConnectionFactory object’s setConnAttemptCount(), setConnAttemptDelay(), and setConnAttemptTimeout() methods to establish new connection failure parameters:

       factory.setConnAttemptCount(10);
       factory.setConnAttemptDelay(1000);
       factory.setConnAttemptTimeout(1000);
  • C

    Use the tibemsConnectionFactory_SetConnectAttemptCount and tibemsConnectionFactory_SetConnectAttemptDelay functions to establish new connection failure parameters:

       status = tibemsConnectionFactory_SetConnectAttemptCount(
                    factory, 10);
       status = tibemsConnectionFactory_SetConnectAttemptDelay(
                    factory, 1000);
       status = tibemsConnectionFactory_SetConnectAttemptTimeout(
                    factory, 1000);
  • C#

    Use the ConnectionFactory.SetConnAttemptCount, ConnectionFactory.SetConnAttemptDelay, and ConnectionFactory.SetConnAttemptTimeout and methods to establish new connection failure parameters:

       factory.setConnAttemptCount(10);
       factory.setConnAttemptDelay(1000);
       factory.setConnAttemptTimeout(1000);