ok, after changing how I was going about this, I have found a elegant enough
way of doing this.
@Component
public class ReloadRoutes implements ApplicationContextAware {
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
this.applicationContext = applicationContext;
}
ApplicationContext applicationContext;
public String reload(String camelContextName) throws Exception {
CamelContextFactoryBean camelContextFactory =
applicationContext.getBean("&" + camelContextName,
CamelContextFactoryBean.class);
SpringCamelContext camelContext = camelContextFactory.getContext();
camelContext.stop();
camelContext.destroy();
camelContextFactory.setContext(null);
for (RouteBuilder
rb:applicationContext.getBeansOfType(RouteBuilder.class).values()) {
rb.getRouteCollection().setRoutes(new ArrayList()); // must
clear the routes!
rb.configure();
}
camelContextFactory.afterPropertiesSet();
camelContextFactory.getContext(true).start();
return "ok";
}
}
--
View this message in context:
http://camel.465427.n5.nabble.com/How-do-I-stop-the-RouteBuilders-from-caching-the-routes-they-build-tp4248807p4248915.html
Sent from the Camel - Users mailing list archive at Nabble.com.