You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by hyjshanghai <hy...@gmail.com> on 2011/04/14 08:48:24 UTC

What's the Difference between handled(false) and continued(true) (and more...)?

With regard to the "onException" Spring DSL, here are my questions based the
following 5 definitions (Example A-E).
Note that I replaced &lt; and &gt; with ( and )

1. What's the difference between handled(false) and continued(true)?
(Example C v.s. D)
According to my experience, only continued(true) will really continue
routing as if the exception has not happend.
handled(false) will break out routing, just like what handled(true) does. Is
this normal?

2. Similar to question 1, what's the difference between handled(true) and
continued(false)? (Example B v.s. E)
Should continued(false) also break out the normal routing on exception, just
like what handled(true) does?

3. A famous book on Camel says "OnException doesn’t handle exceptions by
default". 
However, Example A also breaks out normal routing on Exception, just like
what Example B does by my experience.
Is my experience conflicting with the Book's assertion that exception is not
handled by default?

Example A:
       (camel:onException)
            (camel:exception)java.lang.ArithmeticException(/camel:exception)
            (camel:process ref="arithmeticExceptionProcessor" /)
       (/camel:onException)

Example B:
       (camel:onException)
            (camel:exception)java.lang.ArithmeticException(/camel:exception)
           
(camel:handled)(camel:constant)true(/camel:constant)(/camel:handled)
            (camel:process ref="arithmeticExceptionProcessor" /)
       (/camel:onException)
	   
Example C:
       (camel:onException)
            (camel:exception)java.lang.ArithmeticException(/camel:exception)
           
(camel:handled)(camel:constant)false(/camel:constant)(/camel:handled)
            (camel:process ref="arithmeticExceptionProcessor" /)
       (/camel:onException)

Example D:
       (camel:onException)
            (camel:exception)java.lang.ArithmeticException(/camel:exception)
           
(camel:continued)(camel:constant)true(/camel:constant)(/camel:continued)
            (camel:process ref="arithmeticExceptionProcessor" /)
       (/camel:onException)
	   
Example E:
       (camel:onException)
            (camel:exception)java.lang.ArithmeticException(/camel:exception)
           
(camel:continued)(camel:constant)false(/camel:constant)(/camel:continued)
            (camel:process ref="arithmeticExceptionProcessor" /)
       (/camel:onException)
	  

--
View this message in context: http://camel.465427.n5.nabble.com/What-s-the-Difference-between-handled-false-and-continued-true-and-more-tp4302302p4302302.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: What's the Difference between handled(false) and continued(true) (and more...)?

Posted by Claus Ibsen <cl...@gmail.com>.
handle(true) = the exception is handled and removed from the exchange
+ break out routing
handled(false) = the exception is not handled, so it will be stored as
an exception on the exchange + break out routing
continue(true) = handled(true) + continue routing



On Thu, Apr 14, 2011 at 8:48 AM, hyjshanghai <hy...@gmail.com> wrote:
> With regard to the "onException" Spring DSL, here are my questions based the
> following 5 definitions (Example A-E).
> Note that I replaced &lt; and &gt; with ( and )
>
> 1. What's the difference between handled(false) and continued(true)?
> (Example C v.s. D)
> According to my experience, only continued(true) will really continue
> routing as if the exception has not happend.
> handled(false) will break out routing, just like what handled(true) does. Is
> this normal?
>
> 2. Similar to question 1, what's the difference between handled(true) and
> continued(false)? (Example B v.s. E)
> Should continued(false) also break out the normal routing on exception, just
> like what handled(true) does?
>
> 3. A famous book on Camel says "OnException doesn’t handle exceptions by
> default".
> However, Example A also breaks out normal routing on Exception, just like
> what Example B does by my experience.
> Is my experience conflicting with the Book's assertion that exception is not
> handled by default?
>
> Example A:
>       (camel:onException)
>            (camel:exception)java.lang.ArithmeticException(/camel:exception)
>            (camel:process ref="arithmeticExceptionProcessor" /)
>       (/camel:onException)
>
> Example B:
>       (camel:onException)
>            (camel:exception)java.lang.ArithmeticException(/camel:exception)
>
> (camel:handled)(camel:constant)true(/camel:constant)(/camel:handled)
>            (camel:process ref="arithmeticExceptionProcessor" /)
>       (/camel:onException)
>
> Example C:
>       (camel:onException)
>            (camel:exception)java.lang.ArithmeticException(/camel:exception)
>
> (camel:handled)(camel:constant)false(/camel:constant)(/camel:handled)
>            (camel:process ref="arithmeticExceptionProcessor" /)
>       (/camel:onException)
>
> Example D:
>       (camel:onException)
>            (camel:exception)java.lang.ArithmeticException(/camel:exception)
>
> (camel:continued)(camel:constant)true(/camel:constant)(/camel:continued)
>            (camel:process ref="arithmeticExceptionProcessor" /)
>       (/camel:onException)
>
> Example E:
>       (camel:onException)
>            (camel:exception)java.lang.ArithmeticException(/camel:exception)
>
> (camel:continued)(camel:constant)false(/camel:constant)(/camel:continued)
>            (camel:process ref="arithmeticExceptionProcessor" /)
>       (/camel:onException)
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/What-s-the-Difference-between-handled-false-and-continued-true-and-more-tp4302302p4302302.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/