Hi Aryan,

The onException() is an interceptor which is called before and after
leaving one of the processors defined in a Apache Camel route. So,
basically, it can't be used to intercept exceptions throwed by a specific
processor/endpoint. Nevertheless, you could imagine to set a specific
Header value inside your processor A or B that you will check with the
onException().onWhen(header("processor").isEqualTo("A")). The alternative
as you did is to use doTry around the endpoint/processor

Regards,



On Mon, Sep 29, 2014 at 3:04 PM, Aryan <kanwal.is...@gmail.com> wrote:

> Hi All,
>
> We have a camel route and we want to handle exceptions per endpoint. For
> example, if the exception is thrown from processor A, we want A number of
> retries, if thrown from processor B, we want B number of retries and so on.
>
> We can handle the exception using doTry and throw our customized exception
> per endpoint and then apply different number or retries using OnException.
> Not sure if it is the best approach though. Camel allows exceptions
> policies
> to be applied per route and per context, is it possible to configure it per
> endpoint? Please advice. Or is there any other clean way to do it.
>
> Thanks!
> Aryan
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Handling-error-per-endpoint-tp5757191.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Reply via email to