Connection Recovery
When an unshared state connection fails, the connection’s ExceptionListener callback is invoked. To recover the connection—repair it so that it is connected to an active server—the client application calls the connection factory’s recoverConnection method or tibemsUFOConnectionFactory_RecoverConnection function.
This must be performed in the ExceptionListener callback. The recover connection method blocks until the connection (and its related objects, including sessions, producers, and consumers) are fully recreated, or until it has failed in all its attempts to recreate these objects.
As long as the unshared state client has a valid connection, the API behaves the same as the standard EMS client. However, when the unshared state client’s connection is broken, the API performs as follows:
- Methods called inside a MessageListener callback immediately return a Java exception ConnectionFailureException or C status of TIBEMS_SERVER_NOT_CONNECTED.
- Methods called elsewhere block until the connection is valid again.
Note that the connection is considered broken from the point where the underlying TCP/SSL connection fails, and until recoverConnection or tibemsConnectionFactory_RecoverConnection successfully returns.