WSO2 ESB 在消息传输期间将字符串追加到终结点 URL



在我的用例中,我有这个代理:

<?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>

其中,端点工作线程群集测试具有以下配置:

<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>

当消息到达workerClusterTest端点或replicaTest时,我想在他们的地址URL中插入一个字符串:"MyString"。确切地说,如果消息被发送到workerClusterTest端点,我希望它的url

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

成为

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

序列中有没有办法直接执行此操作?还是自定义类调解员是最好的方法?

据我所知,在 inSequence 中没有办法做到这一点。您必须编写自定义类中介程序才能满足您的需求。

最新更新