Exposing the Quartz Scheduler
Hi all,
I'm trying using a SchedulerFactoryBean in my application to help schedule quartz tasks. This seems great for adding tasks with pre-defined schedules (as the documentation shows), but how does one access the internal scheduler so as to be able to add tasks to it in the future?
My app creates jobs on the fly that are scheduled to execute in the future (and are persisted via JDBC in the interim). I can't seem to figure out how the scheduler is exposed (as a named bean would be the obvious way) for programmatic access, and that has me dead in the water for the time being.
Thanks much for any help,
Dolan Halbrook
Re: Exposing the Quartz Scheduler
Quote:
Originally Posted by dhalbrook
Hi all,
I'm trying using a SchedulerFactoryBean in my application to help schedule quartz tasks. This seems great for adding tasks with pre-defined schedules (as the documentation shows), but how does one access the internal scheduler so as to be able to add tasks to it in the future?
My app creates jobs on the fly that are scheduled to execute in the future (and are persisted via JDBC in the interim). I can't seem to figure out how the scheduler is exposed (as a named bean would be the obvious way) for programmatic access, and that has me dead in the water for the time being.
Thanks much for any help,
Dolan Halbrook
What do you mean "internal scheduler"? When you define a scheduler through the scheduler factory bean, you can just use it with dependency injection by declaring another bean which receives a Scheduler property and a "property" tag which sets it with a reference to the scheduler itself. You then use the scheduler api in order to set new jobs.
Re: Exposing the Quartz Scheduler
+1
I'm trying to do the exact same thing. I have a pre-defined Job but need to create unique Triggers and JobExecutionContexts so users in my system can run the job at a frequency of their own choosing (once a day, once a week, etc) and personalized for them.
immanuel, your response, while appreciated, doesn't help much. I'm sure it's possible - I just need a concrete example of how it's done. The SchedulerFactoryBean does not seem to expose its internal Scheduler.
Quote:
Originally Posted by dhalbrook
My app creates jobs on the fly that are scheduled to execute in the future (and are persisted via JDBC in the interim). I can't seem to figure out how the scheduler is exposed (as a named bean would be the obvious way) for programmatic access, and that has me dead in the water for the time being.