Re: Enable disable routes at startup using Spring
Willem, Thanks for the assist. To aid anyone else that might follow this trhead, here is what I ended up implementing: start applicaiton with something like -Denvironment=dev or -Denvironment=prod main context xml uses: import resource=some-context-${environment}.xml/ to import either some-context-dev.xml or some-context-prod.xml some-context-dev.xml defines: routeContext id=aContext xmlns=http://camel.apache.org/schema/spring; /routeContext and some-context-prod.xml defines: routeContext id=aContext xmlns=http://camel.apache.org/schema/spring; /routeContext -- View this message in context: http://camel.465427.n5.nabble.com/Enable-disable-routes-at-startup-using-Spring-tp5732852p5732975.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Enable disable routes at startup using Spring
Willem, I am loading the properties in a bean: bean id=propLoader class=com.aaa.bbb.ccc.PropLoader/ public class PropLoader extends BridgePropertyPlaceholderConfigurer { ... Properties props = new Properties(); for (String prop : myProperties.getPropertyNames()) { if (prop != null) { // this loads the property enableRoute with value true or false props.setProperty(prop, myProperties.getValue(prop)); } } super.setProperties(props); ... } this bean is in the depends-on for the camelContext: camelContext xmlns=http://camel.apache.org/schema/spring; trace=true depends-on=propLoader,otherbean route autoStartup=${enableRoute} ... /route /camelContext I am basing this off of info from: http://camel.apache.org/how-do-i-use-spring-property-placeholder-with-camel-xml.html I tried to use the {{enableRoute}} naming you mentioned, and I no longer get the exception; however, it does not seem to take because the route starts regardless of the value I set. I'm pretty sure that {{enableRoute}} is not getting the correct value that I am setting via the Spring BridgePropertyPlaceholderConfigurer. Thanks again for the assistance. JC -- View this message in context: http://camel.465427.n5.nabble.com/Enable-disable-routes-at-startup-using-Spring-tp5732852p5732907.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Enable disable routes at startup using Spring
Willem, My error in the last post. Your assitance with the {{xxx}} naming was correct. The variable is being set correctly and can be accessed bia this naming. I thought is was not working because what I am seeing that with autoStartup=false the endpoint still initializes, just the incoming data is not sent to the rest of the route. So, I guess this brings me to a second question. Is there a way to not initialize the endpoint via configuration. The reason that I need is for the following. I have an endpoint (QuickFIXj) that should not be connecting in certain circumstances For example, testing and dev instances should not attemtp to connect to a FIX server via this endpoint. However, prod instances need to have this enabled. I would imagine that this scenario exixst for many connection based services/endpoints. Is there a way to configure the camelContext with what essentially would work like old school compiler derectives: something along the lines of: camelContext route /route #ifdef PROD route /route #endif /camelContext Again, I know this code above is not valid, just an example of what I would need it to work like. As if it was not even there when not in prod. Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/Enable-disable-routes-at-startup-using-Spring-tp5732852p5732911.html Sent from the Camel - Users mailing list archive at Nabble.com.
Enable disable routes at startup using Spring
Is there a way to get something like this to work: route autoStartup=${enableRoute} The value of the attribute is set to a valid parsible string representation of a boolean (ie. true or false) yet I keep getting the following error: org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route8: Route[[From[quickfix:quickfix.cfg]] - [Filter[s... because of Error parsing [${enableRoute}] from property ${enableRoute} as a Boolean. Any assistnace would be greatly appreciated. -- View this message in context: http://camel.465427.n5.nabble.com/Enable-disable-routes-at-startup-using-Spring-tp5732852.html Sent from the Camel - Users mailing list archive at Nabble.com.