camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <>
Subject Re: programatically rewire routes
Date Wed, 22 Apr 2009 13:29:36 GMT
2009/4/22 Peter Maas <>:
> Hi,
> is it possible the programmatically replace parts of a route (for testing
> purposes) to temporarily add processor in the middle of the route for
> example? One case I (think) I need it for is for testing unexpected errors,
> I'd like to mimic this by 'injecting' a processor which throws a unchecked
> exception; the ErrorHandlerTest does do this but only with custom routes...

Two thoughts;

use conditional logic when building the route...

f = from("something");
if (testing) {;
else {;

this just involves assigning where you are in the Java DSL to a
variable - then using Java logical branching.

The other option is to just modify the AST

  List<RouteDefinition> routes = camelContext.getRouteDefinitions();
  RouteDefinition route = routes.get(0);
  // modify AST


Open Source Integration

View raw message