I am getting job details like start time and effective date from the database and on the basis of the job details, I am creating the job but what if I have got another entry for new job or the start time has been changed for the scheduled job, so how new job will be added in the job scheduler or new start time will be changed in the scheduler.
I am using C#.net.
I do not know if it was not possible to update the existing trigger in Quartz in the previous version, but it is possible to update the trigger in the newer version (as of 2.* ).
The update could be achieved as follows (adapted for Quartz.net);
// retrieve the trigger
Trigger oldTrigger = sched.GetTrigger(new TriggerKey("oldTrigger", "group1"));
// obtain a builder that would produce the trigger
TriggerBuilder tb = oldTrigger.GetTriggerBuilder();
// update the schedule associated with the builder, and build the new trigger
// (other builder methods could be called, to change the trigger in any desired way)
Trigger newTrigger = tb.WithSimpleSchedule(x => x.WithIntervalInSeconds(10).WithRepeatCount(10))
.Build();
sched.RescheduleJob(oldTrigger, newTrigger);
Source
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