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 ?
We can pass multiple jobs to spring quartz scheduler along with multiple triggers or single same trigger. Need to create multiple Job classes that implements Job interface. Create multiple Triggers by passing different scheduling times.
P.S In Quartz, one trigger for multiple jobs is not possible. (Correct me if this is wrong.) 1. Quartz APIs Create 3 Quartz’s jobs, JobA, JobB and JobC.
When you wish to schedule a job, you instantiate a trigger and 'tune' its properties to provide the scheduling you wish to have. Triggers may also have a JobDataMap associated with them - this is useful to passing parameters to a Job that are specific to the firings of the trigger.
Once created the IScheduler interface can be used add, remove, and list Jobs and Triggers, and perform other scheduling-related operations (such as pausing a trigger). However, the Scheduler will not actually act on any triggers (execute jobs) until it has been started with the Start () method, as shown in Lesson 1.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With