camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kraythe ." <kray...@gmail.com>
Subject Factoring out exception Handling fragments.
Date Thu, 07 Nov 2013 21:20:46 GMT
Greetings, I have the following exception handling code on every route that
I make. Since it is cut and paste I would love to factor it out into some
kind of route fragment that I could use in each route that is using it. Any
suggestions on how I could go about this? Direct wont work and the error
handler cannot be configured the way I want it (not to mention that there
are a couple of routes that do slightly different things. Thanks for your
time and here is the route snippet:

        .onException(Exception.class).useOriginalMessage().handled(true) //
catch exceptions

        .setHeader(Exchange.FAILURE_ROUTE_ID, property(Exchange.
FAILURE_ROUTE_ID)) // set route that errored

        .setHeader(Exchange.EXCEPTION_CAUGHT, simple(this.STORE_MSG_EXPR)) //
Store reason for error

        .to(ExchangePattern.InOnly,
endpointAMQ(QUEUE_CASE_AUTOMATION_DEAD)).end()
// to DLQ

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message