开发者

Java – Create a workflow in Quartz

I am considering using the Quartz framework to schedule the run of several hundred jobs.

According to their API, jobs can be scheduled to run at certain moments in time but not to run one after the other (and stop a chain of jobs if one fails). The only recommended methods I was able to find are:

  • Using a listener which notices the completion of a job and schedule the next trigger to fire (how to coordinate this?)
  • Each job will receive a parameter containing the next 开发者_运维知识库job to run and, after completing the actual work, schedule its run. (Cooperative)

Do you know a better method to create a workflow of jobs in Quartz?

Can you recommend other methods/framework for implementing a workflow in Java ?

EDITED: In the meantime I found out about OSWorkflow which appears to be a good match for what I need. It appears that what I need to implement is a "Sequence Pattern".


When Quartz documentation talks about "Job", it is referring to a class implementing the "Job" Interface, which is really just any class with an "execute" method that takes in the Quartz Context object. When creating this implementation you can really do whatever you want.

You could create an implementation of the Quartz Job Interface which simply calls all the jobs in your workflow in series, and throws a JobExecutionException exception on failure.


It sounds to me like you want Quartz to schedule the first job, and chain everything off that.

Have you looked at encapsulating each task using the Command Pattern, and linking them together ?


I've worked on a project called Dynamic Task Scheduler that use Quartz to execute job chains implementing a simple workflow in a fault-tolerant way (definied in XML format).

Take a look at http://sourceforge.net/projects/dynatasksched/
The project is beta, but I think it can gives you some ideas to start..

Hope it's useful!


For job chaining support for Quartz, you may want to check the QuartzDesk project that I have been involved in. In version 2.0. we have added a powerful job chaining engine that enables you to orchestrate your Quartz jobs without the need to modify your application code.

The engine takes care of propagating the job execution result and other parameters from the source job to the chained target job.

QuartzDesk comes with a GUI that allows you to dynamically update your job chains without disrupting your application.

Java – Create a workflow in Quartz

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜