Session affinity load balancing proxy problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Session affinity load balancing proxy problem

王朋义
Hi all,

       I try Sample 54: Session affinity load balancing between 3 endpoints, and it works perfectly.

       I need change it to a proxy, which set the soap header(ClientID)  according to the input message.

       So I set up a proxy below:

       <?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="LBSTest" transports="http" startOnLoad="true" trace="disable">
    <target>
        <inSequence>
            <log level="custom">
                <property xmlns:ser="http://services.samples" name="userId" expression="//ser:sampleOperation/ser:param"/>
            </log>
            <header xmlns:syn="http://ws.apache.org/ns/synapse" xmlns:ser="http://services.samples" name="syn:ClientID" expression="//ser:sampleOperation/ser:param"/>
            <log level="full"/>
            <send>
                <endpoint>
                    <loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
                        <endpoint>
                            <address uri="http://localhost:9001/services/LBService1">
                                <enableAddressing/>
                            </address>
                        </endpoint>
                        <endpoint>
                            <address uri="http://localhost:9002/services/LBService1">
                                <enableAddressing/>
                            </address>
                        </endpoint>
                    </loadbalance>
                    <session type="simpleClientSession">
                        <sessionTimeout>0</sessionTimeout>
                    </session>
                </endpoint>
            </send>
            <drop/>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
    </target>
</proxy>
The LoadbalanceFailoverService is not changed, and I use the value of the //ser:sampleOperation/ser:param as a ClinetID. I send a message Using soapUI, and the ESB log is below:
[2012-01-04 15:37:35,875]  INFO - LogMediator To: /services/LBSTest, WSAction: u
rn:sampleOperation, SOAPAction: urn:sampleOperation, MessageID: urn:uuid:ab4ae41
a-463b-4b6f-b4d3-3cac072d76e6, Direction: request, Envelope: <?xml version='1.0'
 encoding='utf-8'?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-env
elope" xmlns:ser="http://services.samples"><soap:Header><syn:ClientID xmlns:syn=
"http://ws.apache.org/ns/synapse">c1</syn:ClientID></soap:Header><soap:Body>
      <ser:sampleOperation>
         <!--Optional:-->
         <ser:param>c1</ser:param>
      </ser:sampleOperation>
   </soap:Body></soap:Envelope>

But it seems doesn't work, The first C1 message is sent to MyServer1, and the second C1 message is sent to MyServer2.

Any suggestion?
Thanks!

Rocwing

--
带着你现有的记忆和理解,去成为之前的自己。
博客:RocWing's Blog

_______________________________________________
Esb-java-user mailing list
[hidden email]
https://mail.wso2.org/cgi-bin/mailman/listinfo/esb-java-user