开发者

how to make multiple instances execute the same job at the same time not concurrently

开发者 https://www.devze.com 2023-01-05 20:00 出处:网络
I have 4 instances of Quartz Ser开发者_开发技巧ver.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 have 4 instances of Quartz Ser开发者_开发技巧ver. 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.


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.


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.

0

精彩评论

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

关注公众号