Quartz.NET Updating a Calendar after creating Job
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);
精彩评论