You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by las <la...@gmail.com> on 2017/05/04 16:34:05 UTC
Re throwing exception
I have a route and an onException definition. My exception processor is
getting called. But the exception or error I throw in exception processor is
not getting bubbled to the client.
RouteBuilder builder = new RouteBuilder() {
public void configure() {
// onException(Exception.class).bean("bean");
onException(Exception.class).to("anotherProcessor");
from("queue:a").bean("someBean").to("processor");
}
};
The exception or error gets trapped by fatalfallbackerrorhandler and the
route ends successfully.
--
View this message in context: http://camel.465427.n5.nabble.com/Re-throwing-exception-tp5798653.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Re throwing exception
Posted by las <la...@gmail.com>.
I did that but that will still not fail the junit test.
I handle an exception in the route using onException processor - the
assertion error that's thrown within the onException processor is handled by
camel and test is passing all the time.
--
View this message in context: http://camel.465427.n5.nabble.com/Re-throwing-exception-tp5798653p5799110.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Re throwing exception
Posted by Claus Ibsen <cl...@gmail.com>.
You need to handle the exception with handled(true)
On Mon, May 8, 2017 at 4:31 PM, las <la...@gmail.com> wrote:
> Can I get a response?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Re-throwing-exception-tp5798653p5799108.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Re: Re throwing exception
Posted by las <la...@gmail.com>.
Can I get a response?
--
View this message in context: http://camel.465427.n5.nabble.com/Re-throwing-exception-tp5798653p5799108.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Re throwing exception
Posted by las <la...@gmail.com>.
I am using spring java configuration - though there is nothing related to
camel. It is part of a junit test and the intent is to avoid any sort of
mocking.
In the test case, am instantiating defaultcamelcontext and adding activemq
component and a route.
The route consumes a message from activemq and process it using a bean
followed by another processor.
I've configured onException with a processor where I do the assertions. The
issue is that the assertions errors and other exceptions that are thrown
don't get propagated to junit to be able to mark the test as successful or
failure.
--
View this message in context: http://camel.465427.n5.nabble.com/Re-throwing-exception-tp5798653p5798771.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Re throwing exception
Posted by las <la...@gmail.com>.
NoErrorHandler is not working either.
onMessage processor throws an error and it's not getting propagated. The
exception/error gets added to the exchange and the route is always
successful.
--
View this message in context: http://camel.465427.n5.nabble.com/Re-throwing-exception-tp5798653p5798657.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Re throwing exception
Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
Have you tried using the “NoErrorHandler”? http://camel.apache.org/error-handler.html <http://camel.apache.org/error-handler.html>
> On May 4, 2017, at 10:34 AM, las <la...@gmail.com> wrote:
>
> I have a route and an onException definition. My exception processor is
> getting called. But the exception or error I throw in exception processor is
> not getting bubbled to the client.
>
> RouteBuilder builder = new RouteBuilder() {
> public void configure() {
> // onException(Exception.class).bean("bean");
>
> onException(Exception.class).to("anotherProcessor");
>
> from("queue:a").bean("someBean").to("processor");
> }
> };
>
> The exception or error gets trapped by fatalfallbackerrorhandler and the
> route ends successfully.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Re-throwing-exception-tp5798653.html
> Sent from the Camel - Users mailing list archive at Nabble.com.