Is there any way where I can group Camel Contexts or routes based on property value?
I have my environments defined as -Denv="preprod" and I want to group/decide routes and contexts based on that. For example:
For dev env:
<camel:route id="foo" >
<camel:from uri="seda:start"/>
<camel:to uri="mock:result"/>
</camel:route>
For Production:
<camel:route id="foo" >
<camel:from uri="seda:start"/>
<camel:to uri="jmsqueue:result"/>
</camel:route>
I am using Spring Application Context to declare Camel Contexts
You mentioned you use Spring then you can use spring property placeholders, and have different .properties file per environment. And then define the endpoints as <endpoint>
and refer to these endpoints in the route. See this FAQ: http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html
Then its a matter of configuring spring property placeholder to use your -D system environment to load the .properties file for the given environment.