Support for N failover URLs has been incorporated in FioranoMQ. This feature backup support of N other servers to be specified. If the primary server goes down, all the connected clients connect to one of the N failover servers. If this failover server goes down, then all the clients connect to one of the N-1 servers. If one/any of the servers that are down, come(s) up, then the number of options for the clients, in terms of servers that they can connect to, increases by one.
Usage
Failover URLs are specified while creating the Connection Factories. While creating connection factories through Fiorano Admin Studio, the failover URLs are set using the Backup Connect URLs parameter. Please refer to section 4.7.1 Creating a Connection Factory. While creating Connection Factories through the code, the failover URLs are set using the setSecondaryConnectURLs (String parameter) API in ConnectionFactory class.
The N FailoverURL support has been extended to the lookup operation as well. Client applications can set a semi-colon separated string of urls (syntax given below) in the InitialContext environment. If the primary server is unavailable for any reason, the FioranoMQ runtime looks up the same object from the server running on the backupURL.
Syntax
SecondaryURLs string is a list of valid URLs separated by semi colons.
Below is a valid entity: http://schumacher:1856;http://barrichello:1956;http://ayrton:2056
Below is an invalid entity: http://schumacher:1856:http://barrichello:1956:http://ayrton:2056
Sample Scenario
Consider a scenario where there are four FioranoMQ Servers.
(Server1, Server2, Server3, and Server4.)
- server1 running on HTUhttp://schumacher:1856
- server2 running on Thttp://barrichello:1956
- server3 running on Uhttp://ayrton: 2056
- server4 running on HUhttp://ferrari:2156
Create a QueueConnectionFactory (myqcf) on server1 with
- primaryURL = http:// schumacher:1856,
- secondaryURLs = http://barrichello:1956;http://ayrton:2056; http:// ferrari:2156,
- clientId=fiorano,
- description = a queue connection factory1.
Client1 (any Sender/Receiver) connects to server1 (looks up myqcf) and starts sending/receiving messages. Now, if server1 goes down, then client1 uses the revalidate method to connect to the next available running server (server2 in this case). Similarly, if server2 goes down, then client1 connects to server3, and so on. Clients can connect to any running servers that are specified in the list of primaryURL or SecondaryURL. If a server that had gone down comes up, it is rendered available for client connection once again.
Code Snippet