You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by James Green <ja...@gmail.com> on 2016/08/04 09:35:50 UTC

onException documentation error?

Referencing http://camel.apache.org/exception-clause.html under "Marking
exceptions as handled" is an example "Example using handled" where it is
stated:

"In this route below we want to do special handling of all
OrderFailedException as we want to return a customized response to the
caller. First we setup our routing as:"

[ skip code ]

I've written a test that shows that the caller does not receive anything at
all. In fact, the only circumstances in which the Exchange propagates
beyond the onException rules are:

1. Where continued is set and the Exchange will continue along the existing
route as if nothing had happened (as documented)
2. Where the onException rules include explicit to("direct:foo") where
direct:foo will then receive the Exchange.

Importantly, if an Exchange is passed (mid-way) from one route to another
and the second route handles an Exception, the Exchange does not return to
the original route (where further processing of any responses from that
second route may be parsed). This is contrary to standard Java call stack
of a method (A) in one class resuming when calling a method (B) in a second
class where that method B experiences and handles an Exception itself.

The simple answer, assuming I have this right and it is expected, is to
update the documentation to that that the Exchange will be dropped until
the onException rules apply a to() directive.

I hope this makes sense!

Thanks,

James