On Tue, Dec 29, 2009 at 12:29 AM, huntc <hu...@mac.com> wrote:
>
> One thing that has always eluded me is how to specify that something be done
> immediately upon the CamelContext having started up.
>
> For example, I have a Quartz based service that executes every hour at 10
> minutes past the hour. However when the CamelContext starts up I'd like this
> service to be invoked immediately and then go into its scheduling behaviour.
> This is so that other consumers of the services I provide can get their data
> immediately without having to wait up to an hour given service startup.
>
> Firstly it'd be great if there was an option on the Quartz component to
> always fire off an initial event. However in general terms it'd be great to
> have the ability to specify that a route is invoked upon the CamelContext
> having been established (with all of its routes configured within the
> current RouterBuilder). Perhaps RouteBuilder needs a new overide-able method
> that is invoked in this situation.
>
> Incidentally I see many references to from("direct:start") throughout the
> doco and examples, but no idea of how this route is invoked.
>

Just a note. Do you want the route to trigger *only* when CamelContext
has just been started?
What if you stop and start the route later, eg using JMX?

I wonder if Quartz got some configuration to fire on startup as well?

But anyway Stephen showed a great solution later in this mail thread.

Also you can just register some spring bean and have it depends on
camel and then fire in some messages to the routes you want to get
started.
But the notification might be a nicer solution as you get fine grained
callbacks and can fire upon camel context started etc.



> Thanks for any help in unwinding my confusion.
> --
> View this message in context: 
> http://old.nabble.com/Startup-invocation-of-a-route-tp26949232p26949232.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to