如何使多个实例同时而不是同时执行同一个作业

发布于 2024-09-09 03:21:23 字数 101 浏览 7 评论 0原文

我有 4 个 Quartz Server 实例。所有实例都指向一个 ADO JobStore。我想做的就是让每个 Quartz 实例同时执行相同的作业。

我希望它足够清楚。

I have 4 instances of Quartz Server. All of the instances point to one ADO JobStore. All I want to do is to make each Quartz instance execute the same job at the same time.

I hope it's clear enough.

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

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

发布评论

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

评论(2

爱的故事 2024-09-16 03:21:23

开箱即用不支持此功能。每当触发器触发时,它只能被一个实例消耗。您可以触发 4 个触发器,但不能保证该作业不会在一个实例上运行两次。

如果您希望每个实例触发一次作业,那么您将必须设置 4 个单独的作业存储。

This isn't supported out of the box. Whenever a trigger fires, it can only be consumed by one instance. You could fire 4 triggers, but it is not guaranteed that the job will not run twice on one instance.

If you want each instance to fire the job once, then you will have to set up 4 separate job stores.

假面具 2024-09-16 03:21:23

我所做的(在 Quartz.NET 2.4.1 中)是我有多个相同的调度程序实例,它们仅在调度程序实例名称(quartz.scheduler.instanceName)上有所不同。他们注册相同的作业和触发器。由于调度程序实例名称不同,作业和触发器在作业存储中会重复(调度程序名称是 JobStoreTX 每个表中主键的一部分)。这会导致逻辑上相同的触发器同时在所有调度程序实例上触发。不过,它们实际上是单独的触发器,因此每个触发器都会单独处理失火等。

What I do (in Quartz.NET 2.4.1) is that I have multiple identical scheduler instances, which only differ in scheduler instance name (quartz.scheduler.instanceName). They register identical jobs and triggers. Because of different scheduler instance names, the jobs and triggers are duplicated in the job store (scheduler name is part of the primary key in every table of JobStoreTX). This causes logically the same triggers to fire on all scheduler instances at the same time. They are actually separate triggers, though, so each will handle misfires etc separately.

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