camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Lomov <>
Subject Trying to figure out how errorHandler, onException and throwException work.
Date Tue, 17 Dec 2013 12:45:33 GMT
Hi Camel Riders,
I've stumbled over errorHandler and onException features and still couldn't
figure out what are theirs limitations. I'm concerned with having three
routes, each in a separate Blueprint Camel context, let's call them
'facade', 'mediator' and 'support'.
Facade is invoked via CXF-RS, passes exchanges to mediator which leverages
from support to enrich messages and may produce some call-outs to downstream
systems. Then the exchange should be returned to the caller via the facade. 
We have a bunch of strictly defined exceptions that can be thrown  by the
mediator to the facade and facade has to translate those exception to some
response error structures for the caller.
So let's assume the support throws some support-specific exception on some
circumstances, thus the mediator has to handle this exception and adapt is
as a strictly defined exception and throw it to the facade.
The straightforward approach for us was to handle the exception from support
route and throw the strictly defined one:
StrictlyDefinedException()).end(). It seems Camel doesn't like this
construction because of blaming 'Exception occurred while trying to handle
previously thrown exception on exchangeId'.
Setting errorHandler to noErrorHandler seems to disable onException as well.
Sorry for the long preamble and thanks for staying with us :)
Is there any proper approach to:
Bubble an exception from the 'support' route, handle it in the 'mediation'
route which is parent to the 'support', bubble *another exception* from the
'mediation' route to the 'facade' route and finally handle the exception in
the 'facade' route?
Thanks in advance.
P.S. While looking to the NoErrorHandlerBuilder code  I've seen that it
handles onException policies somehow.
Am I doing something wrong?

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

View raw message