cancel
Showing results for 
Search instead for 
Did you mean: 

Scheduling events on a multi instance application

ChrisPaine
Active Contributor
0 Kudos

Hello All,

I've got a question, which hopefully will be easy to solve, however, I'm not so sure.

I'm looking for a simple solution that will allow me to schedule tasks in my applications. I've very happily in the past been using Quartz - however, there is an inherent problem. I need only run the Quartz schedular in one instance of my application. As soon as I start running multiple instances (to enable scaling of application and for redundancy) then I need to ensure that only one of the instances is running the schedule. I've tried doing things like using database table and setting "locks" on a scheduled event with the first instance getting the lock being the one that carries out the event, hoping that the two instances don't access the table at the same time... I think this approach has some clear failings.

I'm really not sure how to do anything else though, as I don't think there is any way for an instance to be aware that others are running, nor to identify itself as the "primary" instance.

In other applications in the cloud it seems this is solved by subscribing to a scheduling service provided by a third party (which has APIs to create scheduled event and to trigger them). Is such a service available on HCP - or can you think of any other way to solve this issue?

Thanks!

Chris

View Entire Topic
matt_steiner
Active Contributor
0 Kudos

Hi Chris,

this is another advice I received internally:

Look for clustered Quartz, see e.g.

http://www.quartz-scheduler.org/documentation/quartz-2.x/configuration/ConfigJDBCJobStoreClustering....

http://www.quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-11.html

there are also some samples


Cheers,

Matthias