Hi

When using doTry .. doCatch then any other kind of error handling such as
onException etc is not active. That is because you are explicit using the
try .. catch EIP pattern.
So the 1st example is correct.

However the 2nd is a potential little bug as it should be the same.
But transacted only works with JMS and JDBC resources so it does not make
sense on a timer route.



On Fri, Jan 28, 2022 at 4:05 PM MÜLLER Christian (ICS460-BAI)
<christian.muel...@spar-ics.com.invalid> wrote:

> Hi Guys,
>
> as far as I understand executing the following code snippet should lead to
> the invoke of the log in the onException block
> => a line “onException called” in the logs
>
>
>
> errorHandler(defaultErrorHandler());
> onException(Throwable.class).log("onException called");
>
> from("timer:reserveRows?fixedRate=true&period=1s")
>         .doTry()
>             .throwException(new Exception("exception in try"))
>         .doCatch(Exception.class)
>             .throwException(new Exception("exception in catch"))
>         .end();
>
>
> When running this code however the onException is never called!
>
> When declaring the route as transacted via .transacted()
>
>
>
> from("timer:reserveRows?fixedRate=true&period=1s")
>         .transacted()
>         .doTry()
>             .throwException(new Exception("exception in try"))
>         .doCatch(Exception.class)
>             .throwException(new Exception("exception in catch"))
>         .end();
>
>
> the snippet works as expected. I am unable to explain this behavior!
> What am I missing?
>
> Many thanks for your support!
> Regards Christian
> Sollten Sie diese E-Mail unbeabsichtigt bzw. irrtümlich erhalten haben, so
> weisen wir Sie darauf hin, dass gemäß § 93 Abs 4 TKG der Inhalt sowie die
> Tatsache des Empfangs dieser E-Mail weder aufgezeichnet noch verwertet oder
> Unbefugten mitgeteilt werden dürfen. Wir ersuchen Sie, die Nachricht von
> Ihrem System zu löschen und sich mit uns in Verbindung zu setzen. If you
> have received this email accidentally or in error, we point out that, in
> accordance with § 93 para. 4 TKG (Telecommunications Act), the contents of
> this email and the fact of its receipt must not be recorded, exploited or
> communicated to unauthorized persons. We ask you to delete the message from
> your system and to contact us.
>
> Intern I Internal
> <https://www.spar-ics.com/>
>
> Dipl. Ing. Christian Müller
> Software Engineer
> Business Automation & Integration
> *Mobile:* +43 664 88748100
> *E-Mail:* christian.muel...@spar-ics.com
>
> *SPAR Business Services GmbH*Information & Communication Services
> Europastrasse 3, 5015 Salzburg, Austria
>
>


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

Reply via email to