Table of Contents |
---|
Introduction
This sample demonstrates how the ESB can handle session aware load balancing between failover endpoints.
The configuration in this sample also uses the session type simpleClientSession
to bind session ID values to servers as in sample 54. The difference in this sample is that fail-over failover endpoints are specified as child endpoints of the load balance endpoint. Therefore, sessions are bound to the fail-over failover endpoints. The session specific data maintained in endpoint servers are replicated among the failover endpoints using a clustering mechanism. Therefore, if one endpoint bound to a session fails, successive requests for that session will be directed to the next endpoint in that failover group.
Prerequisites
For a list of prerequisites, see Prerequisites to Start the ESB Samples.
Building the sample
The XML configuration for this sample is as follows:
...
Start the ESB with the sample 55 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.
The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."Start four instances of the sample Axis2 server on HTTP ports 9001, 9002, 9003 and 9004 respectively and give unique names to each server. For instructions on starting the Axis2 server, see Starting the Axis2 server.
Deploy the back-end service LoadbalanceFailoverService. For instructions on deploying sample back-end services, see Deploying sample back-end services.
Executing the sample
The sample client used here is the Load Balance and Failover Client.
...
Run the following command from the
<ESB_HOME>/samples/axis2Client
directory.Code Block language bash ant loadbalancefailover -Dmode=session
- While the client is running, stop the server named MyServer1.
Analyzing the output
When the client is run, you will see the following output on the client console:
...