Here is what I used
<onException useOriginalMessage="true">
<exception>java.lang.Exception</exception>
<onWhen>
<simple>${exception.message} contains '503' or ${exception.message}
contains '504' or ${exception.message} contains
'java.net.SocketTimeoutException: Read timed out' or ${exception.message}
contains 'java.net.SocketTimeoutException' or ${exception.message} contains
'Connection Reset'</simple>
</onWhen>
<redeliveryPolicy maximumRedeliveries="3"
redeliveryDelay="60000"
retriesExhaustedLogLevel="ERROR"
retryAttemptedLogLevel="WARN"
logExhausted="true" />
<process ref="exceptionHandler" />
<to uri="wmq-qm1-Prod1-FIT:queue:{{ ErrorQueue}}" />
</onException>
-----Original Message-----
From: pholder [mailto:[email protected]]
Sent: Friday, September 11, 2015 8:16 PM
To: [email protected]
Subject: redeliveryPolicy onException based on HTTP statusCode
Hello all,
I am looking for a way to have a different redeliveryPolicy in Case the HTTP
statusCode is '503'.
I guess, I could do a try/catch finally every time I make a HTTP-Request. My
hope was to make that switch at one position, for all routes.
Does anyone have a thought on this problem.
This is what I have tried:
<onException>
<exception>org.apache.camel.component.http.HttpOperationFailedException</exception>
<process ref="getHttpStatus"/>
<choice>
<when>
<simple>${exchangeProperty[errorStatusCode]} == '503'</simple>
<throwException ref="ServiceNotAvailableException"/>
</when>
<otherwise>
<throwException ref="HttpErrorException"/>
</otherwise>
</choice>
</onException>
<onException>
<exception>de.cit.eg.transfer.exception.ServiceTemporarilyNotAvailableException</exception>
<redeliveryPolicy asyncDelayedRedelivery="true"
redeliveryDelay="3600000" maximumRedeliveries="3" logRetryAttempted="true"
logNewException="false" retryAttemptedLogLevel="WARN"
backOffMultiplier="4"/>
<to
uri="log:configLogger?level=ERROR&showProperties=true&showException=true&showCaughtException=true&showStackTrace=true&multiline=true"/>
</onException>
<onException>
<exception>de.cit.eg.transfer.exception.DefaultHttpException</exception>
<to
uri="log:configLogger?level=ERROR&showProperties=true&showException=true&showCaughtException=true&showStackTrace=true&multiline=true"/>
</onException>
With regards
--
View this message in context:
http://camel.465427.n5.nabble.com/redeliveryPolicy-onException-based-on-HTTP-statusCode-tp5771448.html
Sent from the Camel - Users mailing list archive at Nabble.com.