Mohan
Mohan

Reputation: 520

Mule retry using until successful scope during external webservice call if the service is down

I am facing problem with until successful scope , the use-case as follows

mule flow contains: inbound : http endpoint

outbound: http outbound calling external web service

i designed flow such that i defined my external web service call inside until successful scope, the requirement is that, retries need to happen if external service is down and should stop retry in between when the service is up and running

I couldn't achieve it.

Required inputs how i can acheive it and also the correct failureExpression need to be define for untillsuccessful scope.

Mule version(3.5.1) - Anypoint Studio - July 2014

Config:

<until-successful
    maxRetries="3"
    doc:name="Until Successful"
    millisBetweenRetries="5000"
    failureExpression="#[exception.causedBy(java.net.ConnectException) ||
        exception.causedBy(java.net.SocketTimeoutException) ||
        exception.causedBy(java.net.SocketException)]" synchronous="true">
    <http:outbound-endpoint exchange-pattern="request-response"
        method="POST" address="http://localhost:8088/mockPriceSoapBinding"
        doc:name="HTTP" mimeType="text/html" tracking:enable-default-events="true" />
</until-successful>

Upvotes: 0

Views: 2594

Answers (2)

vikram kumar u
vikram kumar u

Reputation: 205

As we discussed earlier i have tried with status code based combination on failure expression. Here the retries are happing correctly. The problem here is, if the remote service available before number of retries, still the retries are continuing and flow is not getting executed.

failure expression:#[header:INBOUND:http.status != 200]

Upvotes: 0

David Dossot
David Dossot

Reputation: 33413

If there's no exception, the current failure expression will NPE. Check for nullity like this:

failureExpression="#[exception != null && (exception.causedBy(java.net.ConnectException) || exception.causedBy(java.net.SocketTimeoutException) ||

exception.causedBy(java.net.SocketException))]"

You may need to manually escape & in &amp; depending on how you enter this expression.

Upvotes: 2

Related Questions