osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dealing with exceptions in onExceptions definitions


Hi

This is by design, to avoid circular onException to trigger in endless.
So try to design your error handling in a more safe manner
On Tue, Nov 13, 2018 at 10:23 AM Dennis Holunder <dennisholu@xxxxxxxxx> wrote:
>
> Hello,
>
> I have two onException definitions which catch exceptions and send
> them to direct:logerrors endpoint. The second exception might throw an
> exception which should be caught and handled by the first one. But
> this doesn't work. The FatalFallbackErrorHandler kicks in and as the
> result the exception is not logged by direct:logerrors, as I wish. Any
> ideas how to safely implement this?
>
>         from(direct:start)
>             .onException(UpdateException.class) //retries and logs the error
>                 .handled(true)
>                 .maximumRedeliveries(5)
>                 .redeliveryDelay(1_000L)
>                 .to(direct:logerrors)
>             .end()
>             .onException(IgnoredException.class) //saves the POJO and
> logs the error
>                 .handled(true)
>                 .process().body(Pojo.class, processor::update) //
> throws UpdateException
>                 .to(direct:logerrors)
>             .end()
>
> Regards,
> Dan



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2