2012-08-14 89 views
1

我有一項服務。如果端點在30秒內無法響應。我會丟棄消息。我在終端中設置了它,但沒有用,有人告訴我這是一個錯誤。所以我想用一個錯誤序列來處理這個問題。但仍然失敗。任何人都可以告訴我該怎麼做?如何處理超時錯誤?

If the endpoint can not response in 30 seconds, then execute EndpointError sequence. 
Best regards. 

<proxy xmlns="http://ws.apache.org/ns/synapse" name="EndpointTest" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> 
    <target> 
     <inSequence onError="EndpointError"> 
     <log level="full" /> 
     </inSequence> 
     <outSequence onError="EndpointError"> 
     <log level="full" /> 
     <send /> 
     </outSequence> 
     <endpoint> 
     <address uri="http://172.21.11.158:48280/portalAgent/services/receiveMsg" format="pox"> 
      <timeout> 
       <duration>3000</duration> 
       <responseAction>discard</responseAction> 
      </timeout> 
     </address> 
     </endpoint> 
    </target> 
</proxy> 

回答

1

持續時間參數以毫秒爲單位建立,並且您正在配置3000,因此它總是掛起以暫停。如果你想控制懸掛的錯誤,你必須像這樣控制目標部分。

<proxy xmlns="http://ws.apache.org/ns/synapse" name="EndpointTest" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> 
<target faultSequence="EndpointError"> 
    <inSequence onError="EndpointError"> 
     <log level="full" /> 
    </inSequence> 
    <outSequence onError="EndpointError"> 
     <log level="full" /> 
     <send /> 
    </outSequence> 
    <endpoint> 
     <address uri="http://172.21.11.158:48280/portalAgent/services/receiveMsg" format="pox"> 
      <timeout> 
       <duration>30000</duration> 
       <responseAction>discard</responseAction> 
      </timeout> 
     </address> 
    </endpoint> 
</target>