Slide 40
Slide 40 text
40
Error Handling in Camel
onWhen—Allows you to dictate when an exception policy is in use.
onException(HttpOperationFailedException.class).onWhen(bean(MyHttpUtil.class, "isIllegalData"))
.handled(true).to("file:/acme/files/illegal");
onRedeliver—Allows you to execute some code before the message is redelivered
errorHandler(defaultErrorHandler()
.maximumRedeliveries(3)
.onRedeliver(new MyOnRedeliveryProcessor());
onException(IOException.class)
.maximumRedeliveries(5)
.onRedeliver(new MyOtherOnRedeliveryProcessor())
retryWhile—Allows you, at runtime, to determine whether or not to continue redelivery or to give up
onException(IOException.class).retryWhile(bean(MyRetryRuletset.class));