2017-02-28 73 views
1

我試圖爲https請求組件配置響應超時。 我的http連接器正在調用一個URL,如果沒有來自關閉此https連接的URL的迴應,我想在5秒後設置一個時間。 但我在google和mule網站上搜索過沒有相關信息。 這個我正在調用的web服務重置密碼,如果在某段時間後我沒有得到響應,我想關閉它並且不想重置它。Mule Https請求響應超時

下面是示例代碼:

<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="10.255.255.1." port="2446" doc:name="HTTP Request Configuration" responseTimeout="1" usePersistentConnections="false"> 

的responseTimeout沒有做任何事情,我已經使用SOAPUI測試時間嘗試仍然是相同的,無論什麼我把。 在此先感謝

回答

1

我已經在Http-請求配置中設置responseTimeout屬性,它適用於我。

請在下面找到

<!--Http Listener Config for calling Service--> 
    <http:listener-config name="HTTP_Listener_Configuration1" host="0.0.0.0" port="8092" doc:name="HTTP Listener Configuration"/> 

    <http:request-config name="HTTP_Request_Configuration" host="localhost" port="8092" doc:name="HTTP Request Configuration" responseTimeout="5000"/> 

    <flow name="testtimeoutFlow"> 
     <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> 
     <http:request config-ref="HTTP_Request_Configuration" path="/test" method="GET" doc:name="HTTP"/> 
     <catch-exception-strategy doc:name="Catch Exception Strategy"> 
      <logger message="#[message.exception]" level="INFO" doc:name="Logger"/> 
      <set-payload value="#['Time out Error']" doc:name="Set Payload"/> 
     </catch-exception-strategy> 
    </flow> 

<!-- Flow which has delay in responding the data--> 
    <flow name="testtimeoutFlow1"> 
     <http:listener config-ref="HTTP_Listener_Configuration1" path="/test" doc:name="HTTP" allowedMethods="GET"/> 
     <set-payload value="#['HelloWorld']" doc:name="Set Payload"/> 
     <logger message="#[payload]" level="INFO" doc:name="Logger"/> 
<!-- Delay for 10 seconds--> 
     <scripting:component doc:name="Groovy"> 
      <scripting:script engine="Groovy"><![CDATA[sleep(10000); 
return message.payload;]]> 
    </scripting:script> 
     </scripting:component> 
     <logger message="After Script : #[payload]" level="INFO" doc:name="Logger"/> 
    </flow> 

希望這有助於代碼。

+0

謝謝你的工作 –