开发者

Quartz.NET Updating a Calendar after creating Job

开发者 https://www.devze.com 2023-04-03 13:00 出处:网络
I\'ve searched 开发者_高级运维online, but cant find the answer. I\'d like to know if I create a Job, JobDetail, and Trigger with a Holiday Calendar (for excluding dates), how can I maintain that calen

I've searched 开发者_高级运维online, but cant find the answer. I'd like to know if I create a Job, JobDetail, and Trigger with a Holiday Calendar (for excluding dates), how can I maintain that calendar? I noticed a calendar table created by Quartz.net, but that merely contains the calendar name.

Essentially I'd be adding a Job with a holiday calendar attached to its trigger, however the calendar may change in future which will affect the next run time. How should I approach this?


Have you tried using IScheduler.AddCalendar? There are 'replace' and 'updateTrigger' flags on this method. Here's a code sample (untested):

        IScheduler scheduler = new StdSchedulerFactory().GetScheduler();
        var holidayCalendar = new HolidayCalendar();
        holidayCalendar.AddExcludedDate(new DateTime(2013,1,1));
        scheduler.AddCalendar("existingCalendar", holidayCalendar, true, true);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号