I have implemented a retry functionality in my code using camel retry. It will retry a maximum of five times.
onException(Exception.class)
.maximumRedeliveries(5)
.retryAttemptedLogLevel(LoggingLevel.WARN)
.backOffMultiplier(5)
.maximumRedeliveryDelay(5)
.useExponentialBackOff();
Now I want to call a custom method if the threshold has been reached instead of throwing an exception. How can I achieve this?
You can set the handled-flag
to true and then call your custom bean.
onException(Exception.class)
.maximumRedeliveries(5)
.retryAttemptedLogLevel(LoggingLevel.WARN)
.backOffMultiplier(5)
.maximumRedeliveryDelay(5)
.useExponentialBackOff()
.handled(true)
.to("bean:myCustomBean");