camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jweathers777 <>
Subject Camel 1.6.1 - Capturing parsing errors from Validation Component
Date Wed, 25 Nov 2009 15:14:29 GMT

I have a simple pair of routes that look like this:



I've been trying all sorts of ways to trap the SchemaValidationException so
that I can extract the parsing errors in an invalid XML file and combine
them with the original message into a wrapper message to be routed to
another endpoint "file:///error".

Among the many ways that I have tried is this one:
   .process(new ErrorBundler()).to("file:///error");

Then, in my Processor, I try construct my wrapper message from the passed in
exchange, but no matter what I do, the Exception is null and so I cannot
access the parse errors.

I've tried exchange.getException(), exchange.getFault(), and
exchange.getProperty(Exchange.EXCEPTION_HANDLED_PROPERTY, Throwable).

All of them have NULL.

One very ugly way that I managed to obtain the desired effect was to replace
my validation route with this:

My processor's body uses a Java try catch block to wrap a block of code
where I use exchange.getContext().createProducerTemplate() to manually send
an exchange to the validator endpoint and then send the successful result to
my output file endpoint. In the case where the exception is thrown, I
construct my wrapper message and can successfully examine the Exception
message and data in order to send my wrapper message on to my error

While the above "works", it feels like a hack and I suspect that I must be
missing something with the normal Camel onException mechanism.

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

View raw message