Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete trigger for job in Quartz.net

Tags:

c#

quartz.net

How do I delete a trigger for a job in Quartz.net and keep the job? This is only an issue when deleting the last trigger on the job, right now it deletes the job as well.

The code I am using is:

_scheduler.UnscheduleJob(trigger.Key);

and that works fine as long as the job for that triggers has more than one trigger. If this is the last trigger the job is also deleted, and that is something I don't want.

like image 858
Tomas Jansson Avatar asked Apr 03 '13 14:04

Tomas Jansson


1 Answers

When you create your job you have to specify that you want it to stick around after all triggers have been deleted, which you do by calling StoreDurably()

eg

 IJobDetail job = JobBuilder.Create<HelloJob>()
        .WithIdentity("job1", "group1")
        .StoreDurably()
        .Build();
like image 92
sgmoore Avatar answered Sep 25 '22 18:09

sgmoore