Products | Versions |
---|---|
TIBCO Enterprise Message Service | - |
Not Applicable | - |
Resolution:
You do not need to restart your clients after restart the EMS server.
EMS client API provides client reconnection logic in itself. Specifying multiple URLs when connecting to a server triggers the reconnection logic in the EMS client API. If no backup server is present, the client must still provide at least two URLs (typically pointing to the same server) in order for it to automatically reconnect to the server when it becomes available after a failure.
For example, is you are using just one EMS server with the address "tcp://server:7222", you could use the following server url in your EMS client:
serverUrl = tcp://server:7222, tcp://server:7222
The client attempts to connect to each URL in the order listed. If a connection to one URL fails, the client tries the next URL in the list. The client tries the URLs in sequence until all URLs have been tried. If the first failed connection was not the first URL in the list, the attempts wrap to the start of the list (so each URL is tried). If none of the attempts succeed, the connection fails.
EMS allows you to establish separate parameters for initial connection attempts and reconnection attempts.
Further, by default a client will attempt reconnection 4 times with a 500 ms delay between each attempt; anyway, you can modify these settings in the factories.conf file or by means of your client connection factory API.
For example in java you could 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);
The above examples establish a reconnection count of 10, a delay of 1000 ms and a timeout of 1000 ms.
You should pay attention to ft_reconnect_timeout, which is the amount of time, in seconds, a backup server (when it becomes the primary server in a failover situation) waits for clients to reconnect before their state is removed from the shared state. The default value of this parameter is 60. If the value of this parameter is too low, the clients may Not be able to reconnect as you expect.