camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel doTry
Date Wed, 18 Oct 2017 14:48:19 GMT
Hi

Using handled=false on doTry is deprecated and you should not do that.
In the Java DSL you will notice its deprecated.

And yes its the expected behaviour as its deprecated and you are
explicit doing a try .. catch style.

Use onException instead as it can log the message history / stacktrace etc.


On Tue, Oct 17, 2017 at 3:35 PM, Laurentiu Trica
<laurentiu.trica@moredevs.ro> wrote:
> Hello,
>
> I need your help with error handling in doTry/doCatch.
> I have to put the doTry in my route and do some stuff if there is an
> exception, but I also need the exception to be passed along and end up in
> the logs - I use Camel in Servicemix.
>
> Why the bellow example* doesn't work as expected? I mean the exception is
> caught, but even if the handled is set to false, the exception doesn't end
> up in my logs.
>
> <route>
>     <from uri="direct:start"/>
>     <doTry>
>         <process ref="processorFail"/>
>         <to uri="mock:result"/>
>         <doCatch>
>             <exception>java.io.IOException</exception>
>             <!-- mark this as NOT handled, eg the caller will also get the
> exception -->
>             *<handled>*
> *                <constant>false</constant>*
> *            </handled>*
>             <to uri="mock:io"/>
>         </doCatch>
>     </doTry>
> </route>
>
> * copied from:
> https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Fuse/6.2.1/html/Apache_Camel_Development_Guide/BasicPrinciples-ExceptionHandling.html#BasicPrinciples-ExceptionHandling-doTry-Rethrow
>
> Can you please help?
>
> Thanks,
> Laurentiu



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

Mime
View raw message