调度 5-10 个并行 Spring 石英作业

发布于 2024-10-09 12:32:12 字数 127 浏览 0 评论 0原文

我们需要安排 5-10 个作业,这些作业将连续运行以从数据库中获取数据(大量和进程)。所有这些作业预计将连续运行至少 5 天。 我们正计划使用Springquartz,请提供您对此的所有宝贵建议吗?这样做是否是个好主意以及如何实现这一目标?

We need to schedule 5-10 jobs which will run continuously to fetch data from database (large volumes and process). All these jobs are expected to run continuously for a minimum period of 5 days.
We are planning to use Spring quartz, Please provide all of your valuable suggestions on this? Whether is it a good idea to do so and how to achieve this?

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

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

发布评论

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

评论(1

ペ泪落弦音 2024-10-16 12:32:12

是的,如果您需要定期安排定期异步活动(如您所描述的),Quartz 是一个好主意。运行需要 5 天(或 5 分钟或 5 年)并不重要,但是您应该小心指定重复次数(即 cron 表达式),这样您就不会开始每个作业的下一轮在上一个完成之前。 (Quartz 可以帮助您使用 http://static.springsource.org/spring/docs/1.2.9/reference/scheduling.html

另一方面,如果您不需要常规异步活动(即仅一次或不可调度),那么定义一个可运行的可能会更简单(更好的是,使用最新的 JDK 并发助手来实现风险较小的实现)。

Yes, Quartz is a good idea if you need to schedule regular async activity (like what you describe) on a regular basis. It doesn't matter that it takes 5 days (or 5 minutes or 5 years) to run, however you should be careful about specifying the recurrance (i.e., the cron expression) so that you're not starting the next round of each job before the previous one has finished. (Quartz can help you here with options like that described in 22.2.2 of http://static.springsource.org/spring/docs/1.2.9/reference/scheduling.html)

On the other hand, if you don't need regular async activity (i.e., just one time or unschedule-able), then it's probably simpler to just define a runnable (even better, use the latest JDK concurrent helpers for less risky implementations).

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