2016-07-21 62 views
0

我已經把一個直到-succesfull在騾3.7(見下圖):騾,直到成功的重試只超時

<until-successful maxRetries="100" failureExpression="#[exception != null &amp;&amp; (exception.causedBy(java.net.ConnectException) || exception.causedBy(java.net.SocketTimeoutException)) || message.inboundProperties['http.status'] != 500]" synchronous="true" millisBetweenRetries="20000" doc:name="UntilSuccess"> 

<processor-chain> 

    <set-payload value="#[flowVars.operationPayLoad]" doc:name="GetTransactionRequest" /> 

    <ws:consumer config-ref="GetTransactionWSConsumerConfig" operation="execute" doc:name="GetTransaction" /> 
</processor-chain> 

我只關心使得直到成功的重試如果Web服務停止運行或超時。直到成功後才能重試其他例外情況。

但是,我做了一個測試,我得到一個org.mule.module.ws.consumer.SoapFaultException但直到成功不斷嘗試調用Web服務。

如何告訴直到成功忽略所有異常並停止重試,除非Web服務關閉或超時?

乾杯

最大

回答

1

什麼是message.inboundProperties['http.status']在測試的價值?

另外,嘗試把括號 -

#[(exception != null && (exception.causedBy(java.net.ConnectException) || exception.causedBy(java.net.SocketTimeoutException))) || message.inboundProperties['http.status'] != 500]

即(當存在任何這些兩種類型的異常)或狀態500加外括號到異常檢查】

+0

http狀態是 – max

+0

謝謝Manik。 http狀態是500.然而,直到成功繼續嘗試。也許我不明白failureExpression的功能。我也嘗試|| message.inboundProperties ['http.status'] == 503]但它不斷重試。 – max

+0

你用括號試過了嗎?失敗表達式必須返回true,直到成功重試。試着建立一個條件,看看哪一個讓你的例外。 –

2

如MuleSoft文檔中所述,如果發現異常或失敗表達式爲真,則直到成功範圍將重試。失敗表達式不會覆蓋默認行爲。