Configuring Clients for Fault-Tolerant Connections


When a backup server assumes the role of the primary server during failover, clients attempt to reconnect to the backup server (that is, the new primary). To enable a client to reconnect, you must specify the URLs of both servers. Specify multiple servers as a comma-separated list of URLs. Both URLs must use the same protocol (either tcp or ssl).

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.

In the following examples, the first server is tcp://server0:7222, and the second server is tcp://server1:7344 (if first server is not available).

Using TibjmsConnectionFactory in Java

Java clients can list the primary and backup server URLs in the serverURL argument to a TibjmsConnectionFactory constructor. For example:

TibjmsTopicConnectionFactory factory = new  
TibjmsTopicConnectionFactory( 
    "tcp://server0:7222, tcp://server1:7344"); 

ConnectionFactoryInfo Constructor in Java

Java clients can use the Java Administrator API to specify the primary and backup server URLs in the url argument to a ConnectionFactoryInfo constructor. For example:

ConnectionFactoryInfo cfi = new  
ConnectionFactoryInfo( 
    "ssl://server0:7222, 
     ssl://server1:7344, 
     ssl://server2:7222", 
    null, QUEUE_TYPE, params ); 

Connection Constructor in C

C clients list the primary and backup server URLs in the brokerURL argument to a connection constructor. For example:

tibjmsQueueConnection_Create( 
    &qc, 
    "tcp://server0:7222, 
     tcp://server1:7344", 
    NULL, "admin", NULL ); 

JNDI Look-Up

When creating a connection factory using tibemsadmin, an administrator can specify multiple server URLs in the url argument of the create factory command. For example:

create factory myFactory topic 
    url=tcp://server0:7545,tcp://server1:7344,tcp://server2:7433 

Specifying More Than Two URLs

Even though there are only two servers (the primary and backup servers), clients can specify more than two URLs for the connection. For example, if each server has more than one listen address, a client can reconnect to the same server at a different address (that is, at a different network interface). In another example, clients can configure to failover to parallel remote servers for catastrophe recovery.


TIBCO Enterprise Message Service™ User’s Guide
Software Release 4.3, February 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com