-1

In my existing code I am having 2 route builders inside my camelcontext bean

<camelContext xmlns="http://camel.apache.org/schema/spring">
  <routeBuilder ref="routeBuilder1" />
  <routeBuilder ref="routeBuilder2" />
</camelContext>

I want to set the route builder based on the flag values which is configured in system configuration properties.

  • What are you trying to achieve? Why you don't use routes directly? If your goal is to send messages to 2 routes you can use multicast. Not sure if this is what you need. – isaac.hazan Jan 07 '15 at 16:08
  • @isaac.hazan I want to select the root based on the system properties, So that it will be deployable without generating the war again. Here route 1 and route 2 differs totally by their source and destination end point. Sometimes I may require like both the roots to be enabled. – newstackoverflowuser5555 Jan 08 '15 at 05:57

1 Answers1

1

You could define routeBuilder1.enabled = true in your properties and then use:

@Value("${routeBuilder1.enabled}")
private boolean routeEnabled;

@Override
public void configure() throws Exception {
    from("..")
    .autoStartup(routeEnabled)
    .to("...")
}
J2B
  • 1,703
  • 2
  • 16
  • 31
  • When I set the value for routeEnabled as false I am getting the below exception Cannot find any routes with this RouteBuilder reference:RouteBuilderRef[routebuilder1] – newstackoverflowuser5555 Jan 09 '15 at 10:50
  • Solved that exception [Root cause & Solution](http://stackoverflow.com/questions/27897726/getting-the-exception-cannot-find-any-routes-with-this-routebuilder-reference) – newstackoverflowuser5555 Jan 12 '15 at 11:16