You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "razvan.ludvig" <ra...@almazsa.com> on 2012/03/06 17:11:01 UTC
Inconsistent onException behaviour
The attached unit test (
http://camel.465427.n5.nabble.com/file/n5541356/ExceptionHandlingTest.java
ExceptionHandlingTest.java ) fails, but removing the log in the onException
block will make the test pass. The same behaviour can be seen for almost any
statement inside the block (like setBody, setHeader, etc)
I used Camel 2.9.0 for these tests.
Here is the route:
And this is the test snippet:
--
View this message in context: http://camel.465427.n5.nabble.com/Inconsistent-onException-behaviour-tp5541356p5541356.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Inconsistent onException behaviour
Posted by "razvan.ludvig" <ra...@almazsa.com>.
Thanks for your answers. I have a better undestanding now of how the
exception handling works.
Cheers!
------------------------------------------------------------
Răzvan Ludvig
--
View this message in context: http://camel.465427.n5.nabble.com/Inconsistent-onException-behaviour-tp5541356p5550072.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Inconsistent onException behaviour
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
You have hit a corner issue with onException and handled(true) without
any additional processing of the message.
But yeah the DLC should not get the message.
I will log a JIRA.
On Tue, Mar 6, 2012 at 5:11 PM, razvan.ludvig <ra...@almazsa.com> wrote:
> The attached unit test (
> http://camel.465427.n5.nabble.com/file/n5541356/ExceptionHandlingTest.java
> ExceptionHandlingTest.java ) fails, but removing the log in the onException
> block will make the test pass. The same behaviour can be seen for almost any
> statement inside the block (like setBody, setHeader, etc)
>
> I used Camel 2.9.0 for these tests.
>
> Here is the route:
>
>
>
> And this is the test snippet:
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Inconsistent-onException-behaviour-tp5541356p5541356.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Inconsistent onException behaviour
Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi
take a look at example [1] describing the behaviour your're observing:
// since we have no to then the exchange will continue to be routed to the
normal error handler
As you make use of the log DSL you do already route / consume the exchange
inside the onException
clause by itself so that there's nothing more left to deliver for the global
errorHandler. As an example
given your Test you could also equally do:
.log("The body of IN Message was ${body}")
And then you should see the log entry:
"The body of IN Message was Body"
Proving that the exchange was already routed inside the onException clause.
If you would instead use the
log DSL inside the errorHandler then your test will pass:
errorHandler(deadLetterChannel("mock:error").
disableRedelivery().
log("The body of IN Message was
${body}"));
[1]
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/onexception/OnExceptionSubRouteTest.java
Babak
--
View this message in context: http://camel.465427.n5.nabble.com/Inconsistent-onException-behaviour-tp5541356p5541855.html
Sent from the Camel - Users mailing list archive at Nabble.com.