2

Imagine I have a microservices to schedule a reminder. It will be scaled to 3 instances of that microservice and more if need. They share 2 endpoints -> POST(SheduleReminder) and POST(UpdateSheduleReminder)

The first request will be scheduled on instance A (Id = 1), the second on B (Id = 2) and the third on C (Id = 3). Imagine it working with load balancer.

Now if I want update the job with Id = 2, how I can pick/know on what instance of my microservice is the job scheduled in memory?

Is this a problem and I need to manage somehow in what instance is the job running?

Thank you!

Kiril1512
  • 3,231
  • 3
  • 16
  • 41
  • Quartz uses database for clustering.so if your application share same database it is possible.https://stackoverflow.com/questions/58513804/does-quartz-support-execute-once-on-multiple-node/58534137#58534137 – user06062019 Sep 04 '20 at 16:33
  • @user06062019 so I need to enable clustering and setup a database for Quartz? Any additional documentation for that? – Kiril1512 Sep 04 '20 at 16:59
  • 1
    The documentation example link seems to be broken http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/examples/ but you can find details about JobStore here http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/tutorial-lesson-09.html and http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/configuration.html#configuration-of-database-clustering-achieve-fail-over-and-load-balancing-with-jdbc-jobstore .The last link will provide configuration details .I assume this information holds true for quartz .net – user06062019 Sep 04 '20 at 17:19
  • 1
    For .net library https://www.quartz-scheduler.net/documentation/quartz-3.x/configuration/reference.html#clustering – user06062019 Sep 04 '20 at 17:23

1 Answers1

2

Moving comments to Answer.

1 Through RAMJobStore which is volatile it is not possible to achieve clustering of quartz instances as they store data local to the instance where quartz scheduler is running.In case of instance failure the job data/details will be lost.

2 To enable clustering of quartz instances,JDBCStore or .NET equivalent of it should be used.This JobStore persist the data in the database.As long as all the instances of quartz are sharing the same database clustering is possible.

Refer to these links Quartz Clustering documentation for .NET

Important Clustering Setting

user06062019
  • 681
  • 4
  • 9
  • 1
    Thank you for your answer. We want to use CosmosDb for the database and we found this project that we will test and if it works we will implement our own: https://github.com/Oriflame/cosmosdb-quartznet – Kiril1512 Sep 08 '20 at 10:53