Java ߝ在 Quartz 中创建工作流程

发布于 2024-08-07 08:36:18 字数 619 浏览 3 评论 0原文

我正在考虑使用 Quartz 框架来安排数百个作业的运行。

根据他们的 API,作业可以安排在特定时刻运行,但不能一个接一个地运行(如果一个作业失败,则停止一系列作业)。 我能找到的唯一推荐方法是:

  • 使用侦听器来通知作业的完成并安排下一个触发器触发(如何协调此操作?)
  • 每个作业都会收到一个参数,其中包含下一个要运行的作业,然后完成实际工作,安排其运行。 (合作)

你知道在 Quartz 中创建作业工作流程的更好方法吗?

您能推荐其他在 Java 中实现工作流的方法/框架吗?

编辑:与此同时,我发现 OSWorkflow 这似乎很适合我的需要。看来我需要实现的是“序列模式” 。

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".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

完美的未来在梦里 2024-08-14 08:36:18

当 Quartz 文档谈到“Job”时,它指的是实现“Job”接口的类,它实际上只是任何具有接受 Quartz Context 对象的“execute”方法的类。创建此实现时,您确实可以做任何您想做的事情。

您可以创建一个 Quartz 作业接口的实现,它只需串行调用工作流程中的所有作业,并在失败时抛出 JobExecutionException 异常。

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.

爺獨霸怡葒院 2024-08-14 08:36:18

在我看来,您似乎希望 Quartz 安排第一个工作,并将所有内容链接起来。

您是否考虑过使用命令模式封装每个任务,并将它们链接在一起?

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 ?

漆黑的白昼 2024-08-14 08:36:18

我参与了一个名为动态任务调度程序的项目,该项目使用 Quartz 来执行作业链,以容错方式(以 XML 格式定义)实现一个简单的工作流程。

看看http://sourceforge.net/projects/dynatasksched/

该项目是测试版,但我认为它可以给你一些开始的想法..

希望它有用!

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!

叶落知秋 2024-08-14 08:36:18

对于 Quartz 的作业链支持,您可能需要查看我参与过的 QuartzDesk 项目。 版本2.0。我们添加了一个强大的作业链引擎,使您能够编排 Quartz 作业无需修改您的应用程序代码。

引擎负责将作业执行结果和其他参数从源作业传播到链接的目标作业。

QuartzDesk 附带一个 GUI,允许您动态更新作业链,而不会中断您的应用程序。

输入图片此处描述

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.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文