camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wing-tung Leung <>
Subject Starting routes in StartupListener
Date Tue, 08 Nov 2011 13:13:03 GMT

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:

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?

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

Any advice is greatly appreciated,


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message