Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
278 views
in Technique[技术] by (71.8m points)

java - Single job to run in a clustered Quartz scheduler connected to multi-datacenter SQL (db)

I am new to quartz scheduling and thus I read a lot of about how only one job runs in a clustered environment because of following quartz properties:

spring.scheduler.instanceName - $UniqueName
spring.scheduler.instanceId - AUTO
spring.scheduler.jobStoreClass - XYZ
spring.scheduler.jobStoreDriverDelegateClass - XYZ
spring.scheduler.jobStoreIsClustered - true

Here's my understanding: The prevention of running multiple jobs when only one job should be running, happens at database level. The database decides on the basis of instanceID and instanceName whether the job is already running or not. If not, then the first trigger reaching database, triggers the job.

BUT this makes sense when we are connecting to only one URL of database or let's say one datacenter of database.

How do we make sure only one job runs in the below scenario:

  1. 4 quartz schedulers running on dc1 connected to dc1 database.
  2. 4 quartz schedulers running on dc2 connected to dc2 database.

Please note that dc1 database and dc2 database will be in sync after a few milliseconds.

Please let me know. Thanks in advance!

question from:https://stackoverflow.com/questions/65837323/single-job-to-run-in-a-clustered-quartz-scheduler-connected-to-multi-datacenter

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...