Hello, my camel context contains a few routes which should not be started automatically, but it should run a business check first for those routes. My initial idea is to disable "autoStartup" for those routes, and add a custom StartupListener which performs the check and simply calls "startRoute()" on the context if the check passes.
But, this fails to work because "DefaultCamelContext.startRouteService()" checks the camel context is already started or not, and the listeners are already invoked BEFORE setting the "started" flag, just AFTER starting all relevant routes. Listeners are called in the "doStart()" method, BEFORE setting the "started" flag: https://github.com/apache/camel/blob/trunk/camel-core/src/main/java/org/apache/camel/support/ServiceSupport.java#L51 I have the feeling that the documentation of the StartupListener can be improved here, or should the listeners be invoked AFTER the complete start of the context? http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/StartupListener.html If this is intended behavior: other ideas to achieve my goal? Starting routes in "suspended" mode? Use separate Spring bean and "depends-on" which starts the routes AFTER the complete startup of the initial context? (running on camel 2.6.0, but the related code looks similar in current trunk) Any advice is greatly appreciated, Tung