public override IScheduleBuilder GetScheduleBuilder() { SimpleScheduleBuilder sb = SimpleScheduleBuilder.Create() .WithInterval(RepeatInterval) .WithRepeatCount(RepeatCount); switch (MisfireInstruction) { case Quartz.MisfireInstruction.SimpleTrigger.FireNow: sb.WithMisfireHandlingInstructionFireNow(); break; case Quartz.MisfireInstruction.SimpleTrigger.RescheduleNextWithExistingCount: sb.WithMisfireHandlingInstructionNextWithExistingCount(); break; case Quartz.MisfireInstruction.SimpleTrigger.RescheduleNextWithRemainingCount: sb.WithMisfireHandlingInstructionNextWithRemainingCount(); break; case Quartz.MisfireInstruction.SimpleTrigger.RescheduleNowWithExistingRepeatCount: sb.WithMisfireHandlingInstructionNowWithExistingCount(); break; case Quartz.MisfireInstruction.SimpleTrigger.RescheduleNowWithRemainingRepeatCount: sb.WithMisfireHandlingInstructionNowWithRemainingCount(); break; } return(sb); }
private static SimpleScheduleBuilder zCreateSimpleSchedule(Schedule schedule) { SimpleScheduleBuilder sb = SimpleScheduleBuilder.Create(); switch (schedule.MissedScheduleMode) { case MissedScheduleMode.RunImmediately: sb = sb.WithMisfireHandlingInstructionFireNow(); break; case MissedScheduleMode.RunAtNextScheduledTime: sb = sb.WithMisfireHandlingInstructionNextWithRemainingCount(); break; default: throw new NotSupportedException(); } return(sb); }
/// <summary> /// Applies the appropriate misfire handling policy. /// </summary> /// <param name="builder"></param> /// <param name="instruction"></param> void ApplyMisfireHandlingInstruction(SimpleScheduleBuilder builder, ScheduleMisfirePolicy instruction) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } switch (instruction) { case ScheduleMisfirePolicy.Default: // apply no policy, use whatever is set by default break; case ScheduleMisfirePolicy.FireNow: builder.WithMisfireHandlingInstructionFireNow(); break; case ScheduleMisfirePolicy.Ignore: builder.WithMisfireHandlingInstructionIgnoreMisfires(); break; case ScheduleMisfirePolicy.NextWithExistingCount: builder.WithMisfireHandlingInstructionNextWithExistingCount(); break; case ScheduleMisfirePolicy.NextWithRemainingCount: builder.WithMisfireHandlingInstructionNextWithRemainingCount(); break; case ScheduleMisfirePolicy.NowWithExistingRepeatCount: builder.WithMisfireHandlingInstructionNowWithExistingCount(); break; case ScheduleMisfirePolicy.NowWithRemainingRepeatCount: builder.WithMisfireHandlingInstructionNowWithRemainingCount(); break; } }