This documentation is for WSO2 Enterprise Service Bus version 5.0.0. For the latest ESB, view the latest WSO2 Enterprise Integrator documentation.

All docs This doc
Skip to end of metadata
Go to start of metadata

Objective: Demonstrate how to use endpoint templates in a load balance configuration.

<definitions xmlns="">

    <proxy name="LBProxy" transports="https http" startOnLoad="true">
        <target faultSequence="errorHandler">
                        <session type="simpleClientSession"/>
                        <loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
                            <endpoint name="templ_ep1" template="endpoint_template" uri="http://localhost:9001/services/LBService1">
				<parameter name="suspend_duration" value="5"/>
			    <endpoint name="templ_ep2" template="endpoint_template" uri="http://localhost:9002/services/LBService1">
				<parameter name="suspend_duration" value="20"/>
			    <endpoint name="templ_ep3" template="endpoint_template" uri="http://localhost:9003/services/LBService1">
				<parameter name="suspend_duration" value="200"/>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_2.wsdl"/>

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

    <template name="endpoint_template">
	    <parameter name="suspend_duration"/>
	    <endpoint name="annonymous">
		<address uri="$uri">



  • Sample setup is same as LoadBalance endpoint scenario (#154).
  • Start the Synapse configuration numbered 752: i.e. wso2esb-samples -sn 752
  • Start the Axis2 server and deploy the LoadbalanceFailoverService if not already done

Configuration demonstrates a single endpoint template named 'endpoint_template'. Three endpoint templates are created inside loadbalance endpoint which will point to this template. Note different parameters passed on to the same template ie:- service url and suspend duration as parameters

Invoke the client as follows.

ant loadbalancefailover -Dmode=session -Dtrpurl=http://localhost:8280/services/LBProxy

As in the previous loadbalance samples client console will show loadbalance requests going towards three endpoints created from the same template. Notice differnt suspension times for three services in a failed endpoint scenario as well. (reflects different parameters passed onto the template).

  • No labels