Skip to content

Using the Load Balance Endpoint

Session Affinity Load Balancing between Three Endpoints

This sample demonstrates how the Micro Integrator can handle load balancing with session affinity using simple client sessions. Here the session type is specified as simpleClientSession . This is a client initiated session, which means that the client generates the session identifier and sends it with each request. In this sample session type, the client adds a SOAP header named ClientID containing the identifier of the client. The MI binds this ID with a server on the first request and sends all successive requests containing that ID to the same server.

Synapse configuration

Following is a sample REST API configuration that we can used to implement this scenario.

<proxy name="LoadBalanceProxy" startOnLoad="true" transports="http https" xmlns="">
            <header name="Action" value="urn:placeOrder"/>
                    <!-- specify the session as the simple client session provided by Synapse for
                    testing purpose -->
                    <session type="simpleClientSession"/>

                            <address uri="http://localhost:9001/services/LBService1">
                            <address uri="http://localhost:9002/services/LBService1">
                            <address uri="http://localhost:9003/services/LBService1">
            <sequence key="errorHandler"/>

<sequence name="errorHandler">
        <code value="tns:Receiver" xmlns:tns=""/>
        <reason value="COULDN'T SEND THE MESSAGE TO THE SERVER."/>

    <header name="To" action="remove"/>
    <property name="RESPONSE" value="true"/>