On Thu, Dec 3, 2009 at 10:45 AM, kyt <[email protected]> wrote:
>
> Hi,
>
> I need some advice on how to handle an exception in a sub-route and how the
> calling route can continue processing. It is easier to explain this with a
> bit of code:
>
>            from("direct:A")
>                .to("direct:B")
>                .to("direct:C");
>
>            from("direct:B")
>                .onException(Exception.class).handled(true).end()
>                . code that throws an exception
>
>            from("direct:C")
>                ...
>
> Now, if there is an exception in direct:B, direct:C never gets called.
> Through debugging I found out that the pipeline in direct:A stops processing
> because it checks an exchange property (Exchange.ERRORHANDLER_HANDLED). I'm
> using Camel 2.0. Is there a way that the processing in direct:A continues
> after the exception was handled in direct:B?
>

Unfortunately the logic for error handling got a bit complex.
Something to improve in 2.2. I am currently making the TX based
simpler in internal logic.

Back to your use case.
The doTry .. doCatch will work as regular try .. catch and thus what
you would expect so route A will continue

In terms on onException we should improve this over time, adding some
flag to indicate what you want. As some want to use onException to
catch that error and create a custom error messages as reply and thus
not process and further.  And others as you want a kinda try .. catch
logic and just ignore the damn exception.


> Thanks,
> Jens
> --
> View this message in context: 
> http://old.nabble.com/handled-exception-in-sub-route-tp26623326p26623326.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to