camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: <handled/>
Date Wed, 19 Jan 2011 10:45:13 GMT
On Wed, Jan 19, 2011 at 11:32 AM, Remi Malessa <> wrote:
> On 01/19/2011 01:51 AM, Hadrian Zbarcea wrote:
>> If you don't have the Camel in Action book (please don't interpret the
>> previous answer as a request to buy the book) you can find more details
>> about exception handling here:
>> If you are curious to look at
>> the code, look at how CatchProcessor.handles(Exchange) is implemented and
>> used.
> Thanks Hadrian. Ha ha. I did think it was an invite to buy the book :-) I've
> looked at the web page as well, thanks.
>> You didn't post your throwing code, but it looks like camel found an exact
>> match.
> Yes, the code always throws "my.camel.package.ErrorFoundException".
>>  If no handled expression is defined, the exception is considered handled
>> by default, which explains why the behavior you see is the same.
> The book says "(...)whereas onException will, by default, not handle it.
> That’s why you use handled(true) (#1) to
> instruct Camel to handle this exception."
> I wonder if there's an advantage of using <handled/> in one of my examples ?
> Is it any better then the other ?

See figure 5.5. When handled=true, the caused exception will be
removed from the exchange, and the route consumer will not "detect"
any exceptions caused processing the exchange.

When handled=false, the caused exception will be placed on the
exchange, and the route consumer will "detect" the exception and can
react for example by rolling back. This is consumer specific what
action they do on detecting an exception.

>> Cheers,
>> Hadrian
> Thanks
> Remi

Claus Ibsen
Twitter: davsclaus
Author of Camel in Action:

View raw message