camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zuokun <zuo...@gmail.com>
Subject How to programatically add/remove camel route
Date Mon, 20 Oct 2008 19:16:15 GMT

Suppose I can get the camelContext injected by CamelContextAware interface,
below is my code

//add all camel routes defined in package org.mypackage, this seems to be
working
RouteBuilderFinder rbf = new RouteBuilderFinder((SpringCamelContext)
camelContext, new String[]{"org.mypackage" },
this.getClass().getClassLoader(), null);
List<RouteBuilder> builders = new ArrayList<RouteBuilder>();
rbf.appendBuilders(builders);

for(RouteBuilder rb : builders) {
	  camelContext.addRoutes(rb);
}

//remove all camel routes, this is NOT the right way, could someone show me
an example
camelContext.getRoutes().clear();

Could someone shed some light, thanks!

-- 
View this message in context: http://www.nabble.com/How-to-programatically-add-remove-camel-route-tp20076542s22882p20076542.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message