-1

in my use case I have this proxy:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
   name="MIOProxy"
   transports="https,http"
   statistics="disable"
   trace="disable"
   startOnLoad="true">
   <target>
      <inSequence>
         <sequence name="blackListCheck"/>
         <send>
             <failover>
        <enpoint key="workerClusterTest" />
                <enpoint key="replica_test" />
              </failover>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>

where the endpoint workerClusterTest has this configuration:

<endpoint xmlns="http://ws.apache.org/ns/synapse" name="workerClusterTest">
   <property name="class" value="worker" scope="axis2"/>
   <loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
      <endpoint>
         <address url="http://localhost:8080/myservice1" />
      </endpoint>
      <endpoint>
         <address url="http://localhost:8080/myservice2" />
      </endpoint>
      <endpoint>
         <address url="http://localhost:8080/myservice3" />
      </endpoint>
   </loadbalance>
</endpoint>

While the message is reaching the workerClusterTest endpoint or the replicaTest, i want to insert in their address url a string: "MyString". Precisely if the message is sent to the workerClusterTest endpoint i want that its url

url="http://localhost:8080/myservice1"

to become

url="http://localhost:8080/MyString/myservice1"

is there a way in the inSequence to do this directly? Or a custom class mediator is the best way?

Community
  • 1
  • 1
Alex
  • 1,515
  • 2
  • 22
  • 44
  • So according to above you define 2 endpoints workerClusterTest and replica_test separately. Then why can't you add the required string in the endpoint definition itself? – Nufail Jan 20 '14 at 11:39
  • it's a requirement of the architecture... i mean that the two endpoint are global... while the incoming request regard specific services whose url address are like: http://localhost:8080/MyString/myservice1;http://localhost:8080/MyString1/myservice1; http://localhost:8080/MyString2/myservice1 ... i want to know if i can avoid to repeat a lot of times the endpoint definitions, just keeping those two and then concatenating MyString-1-2-3 to them – Alex Jan 20 '14 at 13:42
  • not really sure but isn't this what you want? https://stackoverflow.com/questions/15876410/wso2-esb-dynamically-change-endpoint-address – Jan Aug 03 '18 at 04:26

1 Answers1

0

As far as I know, there is no way to do this within inSequence. You have to write a custom class mediator to achieve your needs.

Geeth
  • 16
  • 2