首页 文章

WSO2 ESB服务代理不按配置超时

提问于
浏览
3

我们正在使用最新版本的WSO2 ESB(4.6.0) . 我们正在探索为Web服务实现代理服务 . 详情如下所示:

使用WSO2设置Axis2 Webservice自定义服务代理 . 配置如下:代理XML:此突触配置是使用WSO2 UI生成的 .

<proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" transports="https,http" statistics="enable" trace="enable" startOnLoad="true">
   <target faultSequence="myFaultHandler">
      <inSequence>
         <property name="DISABLE_CHUNKING" value="true" scope="axis2" type="STRING"/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
      <endpoint>
         <address uri="http://localhost:9000/services/SimpleStockQuoteService">
            <timeout>
               <duration>3000</duration>
               <responseAction>fault</responseAction>
            </timeout>
            <suspendOnFailure>
               <errorCodes>101504,101505</errorCodes>
               <initialDuration>1000</initialDuration>
               <progressionFactor>2.0</progressionFactor>
               <maximumDuration>10000</maximumDuration>
            </suspendOnFailure>
            <markForSuspension>
               <errorCodes>101507,101508,101505,101506,101509,101500,101510,101001,101000,101503,101504,101501</errorCodes>
               <retriesBeforeSuspension>1</retriesBeforeSuspension>
               <retryDelay>1</retryDelay>
            </markForSuspension>
         </address>
      </endpoint>
   </target>
   <publishWSDL uri="http:// localhost:9000/services/SimpleStockQuoteService?wsdl"/>
   <description></description>
</proxy>

序列myFaultHandler XML:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="myFaultHandler" trace="enable">
   <header name="To" action="remove"/>
   <property name="RESPONSE" value="true"/>
   <property name="NO_ENTITY_BODY" action="remove" scope="axis2"/>
   <log level="custom">
      <property xmlns:ns="http://org.apache.synapse/xsd" name="error-message" expression="get-property('ERROR_MESSAGE')"/>
      <property xmlns:ns="http://org.apache.synapse/xsd" name="error-code" expression="get-property('ERROR_CODE')"/>
      <property xmlns:ns="http://org.apache.synapse/xsd" name="error-detail" expression="get-property('ERROR_DETAIL')"/>
      <property xmlns:ns="http://org.apache.synapse/xsd" name="error-exception" expression="get-property('ERROR_EXCEPTION')"/>
   </log>
   <makefault version="soap12">
      <code xmlns:soap12Env="http://www.w3.org/2003/05/soap-envelope" value="soap12Env:Receiver"/>
      <reason value="Webservice is either down or currently not reachable."/>
      <node></node>
      <role></role>
   </makefault>
   <send/>
</sequence>

当Web服务关闭时,此配置会抛出定义的soap故障 .

当webservice花费时间发回响应时,如代理XML配置中所定义的那样,它应在3秒后超时:

<timeout>
           <duration>3000</duration>
           <responseAction>fault</responseAction>
        </timeout>

即使在超时期限之后,代理仍在等待响应,而不是将故障丢回 .

在分析日志文件时,我们尝试通过修改下面提到的属性文件中的以下参数,但线程仍然等待响应 .

**synapse.properties**  
synapse.global_timeout_interval=3000  
synapse.connection.read_timeout=3000  
synapse.connection.connect_timeout=3000  
synapse.timeout_handler_interval=3000  

**nhttp.properties**  
http.socket.timeout=5000

它最终超时并抛出套接字异常 .

根据规范(http://wso2.com/library/articles/wso2-enterprise-service-bus-endpoint-error-handling),超时发生后, endpoints 应进入超时状态,但在这种情况下, endpoints 仍处于活动状态,既不是故障也不是丢弃消息 . 有时它会抛出错误代码504.但是这个动作并不一致 .

如果最终的Web服务非常慢,请告知给定代理服务超时/丢弃消息所需的更改 .

1 回答

  • 0

    如果您正在使用来自axis2.xml的http传输(位于CARBON_HOME / repository / conf / axis2目录中),则可以通过添加参数来配置该特定传输发送方中的超时参数来解决此问题 . 例如,

    <parameter name="SO_TIMEOUT">3000</parameter>
    <parameter name="CONNECTION_TIMEOUT">3000</parameter>
    

    此致,Asanka Sanjeewa .

相关问题