2012-07-26 99 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>