1

I have a micro-service which is running quartz job for different vendor, am planning to run this on multiple instances, how did i make sure that only one group of job is running on first server and the other group is running on 2nd server.

I am currently using Quartz 2.2.1 version

Anil Gupta
  • 147
  • 7
  • You can refer this : https://stackoverflow.com/questions/12626380/quartz-scheduler-in-cluster-environment. I hope this helps and I am answering your question – Anshul Jul 18 '22 at 11:00
  • Before posting the question i went through the link you shared, and that question is talking about how to run quartz job in a clustered environment, what i am looking for is how to run separate group of jobs to run on diff machines without any code changes, mu current quartz version is 2.1 – Anil Gupta Jul 18 '22 at 11:29
  • First ask yourself, if you really need to do this; in a horizontally scaling clustered environment, all cluster members should be same. In your case, all cluster members will not be the same. For instance if you add a new server to the cluster, which job group should this member process. Having said that, to do this you need to initialize the Quartz Scheduler from different properties file on different server and configure different job store. You will have additional problem of maintaining different job stores or implement your own and use PROP_JOB_STORE_CLASS to set it on the schedulers. – Ironluca Jul 18 '22 at 14:21

1 Answers1

0

You can refer to https://stackoverflow.com/a/55302145/9480909

Just specify different org.quartz.scheduler.instanceName for different applications.

Since the old project I maintain configures the scheduler bean through xml, the configuration method is slightly different.

In short, it is to modify the schedulerName property of org.springframework.scheduling.quartz.SchedulerFactoryBean.

zgy
  • 66
  • 6