Remove trigger to work in Quartz.net

How to remove a trigger for a job in Quartz.net and save work? This is only a problem when deleting the last task trigger, now it also deletes the task.

Code I use:

_scheduler.UnscheduleJob(trigger.Key);

and this works fine as long as the job for these triggers has more than one trigger. If this is the last trigger, the task is also deleted, and this is what I do not want.

+5
source share
2 answers

When you create your task, you must indicate that you want to stick to it after all the triggers have been deleted, what you do by calling StoreDurably ()

eg,

 IJobDetail job = JobBuilder.Create<HelloJob>()
        .WithIdentity("job1", "group1")
        .StoreDurably()
        .Build();
+8
source

You can also use

// Unschedule a particular trigger from the job (a job may have more than one trigger)
scheduler.UnscheduleJob(new TriggerKey("trigger1", "group1"));

Please note that my syntax is slightly different from Quartz.net help

0
source

All Articles