You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by manchandap <ma...@yahoo.com> on 2014/05/06 12:21:24 UTC

Apache Camel | Custom Error Handler to control behavior per Exception.

Apache Camel provides 2 ways for error handling at context level:
/errorHandler /and /onException/.

I am looking for a solution that provides best of both the worlds in one
configuration. /*What I want is that I should configure one error handler
(may be a custom one) and within that custom error handler, I should be able
to control the behavior on per exception basis*/ For Example:

/    if I get IOException, I would make 3 redelivery attempts at an interval
of 3 seconds

    if I get FileNotFoundException, I would make 5 redelivery attempts at an
interval of 10 seconds/

errorHandler would enable me to use one of the provided Error Handlers and
would handle all the exception in a similar ways. For example using this
approach I can’t have different redelivery attempts for different
exceptions.

So, here where onException comes into picture, which is equivalent of
try-catch at camel context level. I can use this to define per Exception
behavior.

I tried to use a custom bean with Dead Letter Channel in an attempt to
control the redelivery attempts from the bean. However, Camel attempts
redelivery before it passes the control to the custom bean.

Any thoughts about implementing the solution that I want.




--
View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Custom-Error-Handler-to-control-behavior-per-Exception-tp5750913.html
Sent from the Camel - Users mailing list archive at Nabble.com.