I'm new to the Quartz scheduler. I had few queries and hope someone give a hand here. Thanks a lot!
First of all, let me share with you on my way to organize the jobs and triggers in single Scheduler:
-
One trigger group, many triggers with unique name
-
Many job groups, many jobs with unique name inside one group
-
One job group may associate with one trigger so that all jobs under this group will be fired at the same time
I think this organization is quite normal in scheduler software. However, I only found references to register same job with multiple triggers. Even though, I still thought to register many jobs with the same trigger is achievable logically.
Following is my own logic to achieve the goal:
-
Job A be created, Trigger A be created, call function scheduleJob(JobA, TriggerA) to register Job A with Scheduler firstly
-
Job B be created, get Trigger A from Scheduler based on its unique name, call function scheduleJob(JobB, TriggerA) to register Job B with Scheduler later
Therefore, refer to my own logic, I had two queries:
-
Is it possible to implement getting Trigger A from Scheduler based on its name ?
-
Is it a correct way to register multiple jobs with same trigger by using scheduleJob() function again and again ?
Best Answer
No, a job can have many triggers relating to it, but a trigger can only relate to one job. Though you can get something of the effect you're after if you use a job/trigger listener and schedule triggers to fire other jobs immediately when the one trigger fires.
You can set up multiple identical triggers, one for each job.