Hi I configured a route with CronScheduledRoutePolicy to stop every afternoon at 6pm and start the following morning again at 4am (because a downstream system is not available). Works fine so far.
Now, what if my component is deployed at 8pm? The route starts, the cron trigger is already passed. I found this old thread where my problem is discussed: http://camel.465427.n5.nabble.com/CronScheduledRoutePolicy-td4552324.html I took the same road to solve this "edge case": I set the route to ".noAutoStart()" and quickly tried to extend CronScheduledRoutePolicy. In the onInit method I retrieve the configured start and stop triggers, compare their next fire dates and decide if the route should be started or not. [At the moment I leave suspend and resume triggers aside] But now, how can I start the route if needed? The consumer is still null at this time. Am I in the wrong method to do this? Or can I use ".autoStartup(bool)", set it by default to false and somehow set the flag to true at this early stage? I even found an event-notifier-solution in this answer on SO: https://stackoverflow.com/a/21759153/8035582 Is this the best way to go? To subscribe to CamelContextStart and start the route if needed? Or is this a too "expensive" solution? Probably isEnabled(EventObject eventObject) could be used to filter the Event types to subscribe to. Thanks for any hints Stephan
