camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Mithe <>
Subject Exception handling
Date Fri, 18 Jul 2014 15:57:26 GMT

I've set up a request-reply and I'm experimenting with exception handling
but I cant see to get it to report properly.

I've set up these routes:


    from("direct:externalService").process(new MyProcessor());

Where MyProcessor does: exchange.getOut().setBody(exchange.getIn().getBody()
+ " was processed!");

That all works great, however, if I change MyProcessor to "throw new
RuntimeException("oh noes");" then it it fails silently with no output.

I can change my route to:

                .process(new MyProcessor());

ExceptionHandler.class has a method "public void handle(Exchange exchange,
Exception e)".  I get the exception and the original exchange by the looks
of it which is great.

However, my original route specifying the inOut seems to receive no response
or exception and seems its request is lost in the ether.

I tried added some exchange.getOut().setBody("Error"); and
exchange.getOut().setFault(true) but still nothing.

I'm I doing something silly here?  I would have expected if an exception was
thrown on the inOut route then the a response would automatically be
generated saying fail.  I think I must be missing something.


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message