Question

The CronCalendar exclusion does not work when I use it with CronScheduleBuilder or SimpleScheduleBuilder.

Working code ( The trigger DOES NOT fires when I run it between 4pm and 4h59pm. )

CronCalendar cc = new CronCalendar("* * 16 * * ?");
sched.AddCalendar("CronCal", cc, false, false);
JobKey jKey = new JobKey("TEST");
IJobDetail jDet = JobBuilder.Create<testJob>()
                      .WithIdentity(jKey)
                      .Build();

ITrigger tg = TriggerBuilder.Create()
                .WithSchedule(CronScheduleBuilder.CronSchedule("*/2 * * * * ?")
                             .WithMisfireHandlingInstructionDoNothing())
                .ModifiedByCalendar("CronCal").Build();


sched.ScheduleJob(jDet, tg);

Not working code ( The trigger fires regardless of the CronCalendar when I run it between 4pm and 4h59pm. )

ITrigger tg = TriggerBuilder.Create()
                .WithSchedule(CalendarIntervalScheduleBuilder.Create()
                .WithIntervalInSeconds(2)
                .WithMisfireHandlingInstructionDoNothing())
                .ModifiedByCalendar("CronCal")
                .Build();

Bug or normal implementation ?

Quartz.net version is 2.1.2.400

Was it helpful?

Solution

CronCalendar only works for CronSchedule

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top