2012-07-26 85 views
0

我需要发送一个请求到多个不同的地址。一些成功,有些可能会返回错误,并且我需要为此响应写入日志。我想我需要 逐个处理响应消息。如何在后果中做到这一点。 我的服务配置是:如何逐个处理响应消息?

<proxy xmlns="http://ws.apache.org/ns/synapse" name="CloneTest" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> 
    <target> 
     <inSequence> 
     <clone id="12345"> 
      <target> 
       <endpoint> 
        <address uri="address1" format="pox" /> 
       </endpoint> 
      </target> 
      <target> 
       <endpoint> 
        <address uri="address2" format="pox" /> 
       </endpoint> 
      </target> 
      <target> 
       <endpoint> 
        <address uri="address3" format="pox" /> 
       </endpoint> 
      </target> 
     </clone> 
     </inSequence> 
     <outSequence> 
     <log level="full" /> 
     <send /> 
     </outSequence> 
    </target> 
</proxy> 

此致敬意。

回答

0

您可以尝试以下方法。首先在ESB中创建三个端点,即“ep1”,“ep2”和“ep3”,对应于要发送克隆请求的三个目标。然后参考您的代理服务配置中的那些端点,如下所示。

<proxy xmlns="http://ws.apache.org/ns/synapse" name="CloneTest" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> 
    <target> 
     <inSequence> 
     <clone id="12345"> 
      <target endpoint="ep1"> 
      <target endpoint="ep2"> 
      <target endpoint="ep3"> 
     </clone> 
     </inSequence> 
     <outSequence> 
     <log level="full" /> 
     <send /> 
     </outSequence> 
    </target> 
</proxy>