Quartz Scheduler: start some tasks in each cluster node and some only once for each cluster

I am using Quartz Scheduler as a Spring bean in a clustered environment.

I have some jobs annotated with @NotConcurrent and they run once for each cluster (i.e. only in one node, only in one thread).

Now I need to run one task on each node of the cluster. I deleted the @NotConcurrent annotation, but it only runs on every thread on the same machine. It does not start on other nodes.

What should I annotate for a job?

Example: Job1 NotConcurrent annotated at midnight => It runs on only 1 machine every midnight. Job2 annotated on schedule at midnight => He fires at each machine every midnight.

Thanks.

+6
source share
1 answer

AFAIK quartz work is always performed on a single node, which is selected by Quartz. Annotating @NonConcurrent only prevents Quartz from doing the same job on a specific node.

In other words, you cannot force Quartz to do the job on multiple nodes at the same time. He always selects one node for the job.

To understand what you described, you may need several tasks (using the same class of tasks and without associated triggers). Then you will need to perform some kind of orchestra task, which will be remotely connected, for example. via JMX or RMI, to individual nodes and run tasks manually.

You can check our QuartzDesk product ( www.quartzdesk.com ), which provides a web service that provides a single endpoint through which you can connect to individual instances of the Quartz scheduler and, for example, run tasks on them.

+7
source

All Articles