views:

306

answers:

3

In Quarts, can I use a single trigger to schedule multiple jobs, so that all the jobs gets executed in parallel. What is the best way to do this.

Example, every hour execute Jobs j1, j2, ..., jn in parallel. Assuming that there is no dependency between the jobs.

A: 

You can build a trigger job that triggers the other jobs. Make it configurable by using the JobMap properties, and you can reuse the class for triggering an arbitrary set of jobs (and maybe executing the first for yourself).

Daniel
+2  A: 

You can't associate multiple jobs with the same trigger (a given job can have multiple triggers, but not vice versa), but you can set up multiple identical triggers, one for each job.

In order to get them running in parallel, you need to ensure that Quartz's thread pool has enough capacity to do so. See here for the config options for the thread pool.

skaffman