![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |
Unshared state failover is an extension of the JMS specification. Because state is not shared among servers, messages can be lost, duplicated, or delivered out-of-order across the failover process.Unshared state connections are created differently from shared state connections in several important ways:
• For Java applications, a JAR file must be present in the environment CLASSPATH of the client.
• For C applications, a header file must be included and clients must link using the unshared state library.Before creating the connection factory, ensure that the CLASSPATH includes the JAR file:Include the tibemsufo.h header file.java com.tibco.tibems.ufo package.tibemsufo library and functions.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:
1. Methods called inside a MessageListener callback immediately return a Java exception ConnectionFailureException or C status of TIBEMS_SERVER_NOT_CONNECTED.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.When a server connection is lost during an unshared state failover, clients attempt to reconnect to the second server. To enable a client to reconnect, you must specify the URLs of both servers when creating a connection.
• Unshared State Specify multiple servers as a list of URLs separated by plus (+) signs. For example, to identify the first server as tcp://server0:7222, and the second server as tcp://server1:7344, you can specify:
• Dual State To combine shared state server pairs with unshared state servers, use commas to separate the servers that share state, and plus (+) signs to separate servers that do not share state. For example, this line specifies server a1 and a2 as a fault-tolerant pair that share state, and servers b1 and b2 as a second pair with shared state:serverUrl=tcp://a1:8222,tcp://a2:8222+tcp://b1:8222,tcp://b2:8222The 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.
Server lookup functions do not permit unshared state syntax. That is, you cannot separate server URLs using the plus (+) symbol during a server lookup.
![]() |
Copyright © TIBCO Software Inc. All Rights Reserved |