开发者

Quartz.NET Instance Handling

开发者 https://www.devze.com 2022-12-25 18:45 出处:网络
I have 2 instances which implements 2 different instance IDs in 2 different windows services as: //windows service 1 instance 1

I have 2 instances which implements 2 different instance IDs in 2 different windows services as:

//windows service 1 instance 1
properties["quartz.scheduler.instanceName"] = "instanceName1";
properties["quartz.scheduler.instanceId"] = "instanceID1";

//windows service 2 instance 2
properties["quartz.scheduler.instanceName"] = "instanceName2";
properties["quartz.scheduler.instanceId"] = "instanceID2";

In the ADOJobstore, I can see that there are two instances.

However, when I schedule a simple job in instance1, it is getting triggered in instance2 (and vise versa). By looking at the records created in jobstore, the scheduled job are 开发者_运维问答properly tagged with the expected instanceIDs. Any idea of why this is happening?


This is the expected behavior. If you have 2 instances pointing to the same store, either instance can pull jobs from it. Basically you are running a cluster of schedulers and AFAIK there is no way to limit jobs to running on one particular server. You will have to set up 2 different job stores if you want jobs to run on one particular server.

0

精彩评论

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