Oct 11th, 2010, 09:04 AM
Quartz vs Spring task scheduler
We're working on a project that requires jobs to be scheduled from a web interface. So far we've got a job working fine, using the SimpleJobLauncher and SimpleAsyncTaskExecutor, passing some parameters to the job entered from the web page.
The next step is to schedule these executions - initially just from the user entering a cron expression on the input page and we're looking at using the Spring 3.0 TaskScheduler implementations vs the provided Quartz beans.
Can anyone give any pros/cons of the above? One requirement that I can't obviously see if either fulfill is persistence. If I schedule a job for tomorrow morning and there's a server re-start inbetween, my web app has no (inbuilt) way of reading it's state and starting the job correctly.
Oct 13th, 2010, 12:53 PM
Quartz has persistent triggers.
Spring Batch has persistent Job meta data, so you could write your own JobLauncher client that combined a non-persistent trigger from Spring with the persistent information it can get from the JobRepository. We haven't done it in the framework yet because there are too many ways that you might want it to work, but I see that in live projects quite frequently. We could do something in the future if someone comes up with a set of crisp use cases.
If your basic use case is just triggering a job every morning, you wouldn't care if the server had been down in the night. Spring just generates triggers as long as it is alive.
Oct 14th, 2010, 03:30 AM
Thanks Dave, I was leaning towards writing some persistence into the project to maintain the schedule information - we're already storing some additional job related information in our db as we're trying to make it as data driven as possible. Adding a cron string in there will probably be the easiest thing and simple to deal with on startup.