如何处理超时错误?

时间:2012-08-14 01:22:18

标签: timeout wso2 endpoint wso2carbon

我有服务。如果端点无法在30秒内响应。我会丢弃消息。我在端点设置了这个,但没有用,有人告诉我这是一个bug。所以我想用一个错误序列来解决这个问题。但仍然失败了。有谁能告诉我怎么做?

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 个答案:

答案 0 :(得分:1)

持续时间Param以毫秒为单位建立,并且您正在配置3000,因此它总是gonnna挂起。如果你想控制出现的错误,你必须像这样控制目标部分。

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