Hello,
I have a main processing route with multiple onException clauses with
useOriginalMessage. So that the errorhandler route knows what error occurred in
the main processing route, I wanted to set a onPrepareFailure. Unfortunately
you cannot set this value in the onException clause. Therefore is the following
the right way to do it?
from(timer("myTimer").period(10000))
.errorHandler(defaultErrorHandler().onPrepareFailure(new
Processor() {
public void process(Exchange exchange) throws Exception
{
exchange.getIn().setHeader("FailureException",
exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class));
}}))
.onException(Exception.class).handled(true).useOriginalMessage().to(seda("mySeda")).end()
.setBody(constant("changed"))
.validate(body().isEqualTo("original"))
.to("stream:out");
However, how do you do this in a route with transactions enabled? How would can
you simply add the processor to the default error handler that is automatically
setup for the route?
The other solution I considered was using useOriginalBody, but this method is
commented that it is deprecated?
Regards,
Marcus Ionker
Marcus Ionker
Product Line Manager
Phone: +49 89 5528-1202
Fax: +49 89 1250400-1202
Mobile: +49 176 15528012
Email: [email protected]<mailto:[email protected]>
-------------------------------------------------------------------------------------------------------
Retarus Blog
Stay up to date and read our latest blog
posts<https://www.retarus.com/blog/en/>.
-------------------------------------------------------------------------------------------------------
retarus GmbH. Aschauer Stra?e 30, 81549 M?nchen, Germany.
www.retarus.com<https://www.retarus.com>