Class SimpleScheduleBuilder
- Namespace
- Quartz
- Assembly
- Quartz.dll
SimpleScheduleBuilder is a IScheduleBuilder that defines strict/literal interval-based schedules for ITriggers.
public sealed class SimpleScheduleBuilder : IScheduleBuilder
- Inheritance
-
SimpleScheduleBuilder
- Implements
- Inherited Members
Remarks
Quartz provides a builder-style API for constructing scheduling-related entities via a Domain-Specific Language (DSL). The DSL can best be utilized through the usage of static imports of the methods on the classes TriggerBuilder, JobBuilder, DateBuilder, JobKey, TriggerKey and the various IScheduleBuilder implementations.
Client code can then use the DSL to write code such as this:
IJobDetail job = JobBuilder.Create<MyJob>()
.WithIdentity("myJob")
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("myTrigger", "myTriggerGroup")
.WithSimpleSchedule(x => x
.WithInterval(TimeSpan.FromHours(1))
.RepeatForever())
.StartAt(DateBuilder.Create().AtHourMinuteAndSecond(10, 0, 0).Build())
.Build();
await scheduler.ScheduleJob(job, trigger);
Methods
Build()
Build the actual Trigger -- NOT intended to be invoked by end users, but will rather be invoked by a TriggerBuilder which this ScheduleBuilder is given to.
public IMutableTrigger Build()
Returns
- See Also
Create()
Create a SimpleScheduleBuilder.
public static SimpleScheduleBuilder Create()
Returns
- SimpleScheduleBuilder
the new SimpleScheduleBuilder
MeasureIntervalFromCompletion(bool)
Measure the interval from the previous run's completion rather than from its scheduled time: a fixed delay, where the default is a fixed rate.
public SimpleScheduleBuilder MeasureIntervalFromCompletion(bool measureIntervalFromCompletion = true)
Parameters
measureIntervalFromCompletionboolwhether to measure from completion
Returns
- SimpleScheduleBuilder
the updated SimpleScheduleBuilder
Remarks
The trigger never overlaps itself: it is held while a firing runs, on every node, and its next fire time is the completion time plus the interval. The repeat count still counts runs, and the end time still bounds them. Every node of a cluster must be 4.7 or later.
- See Also
RepeatForever()
Specify that the trigger will repeat indefinitely.
public SimpleScheduleBuilder RepeatForever()
Returns
- SimpleScheduleBuilder
the updated SimpleScheduleBuilder
- See Also
WithInterval(TimeSpan)
Specify the interval at which the trigger repeats.
public SimpleScheduleBuilder WithInterval(TimeSpan timeSpan)
Parameters
timeSpanTimeSpanthe time span at which the trigger should repeat.
Returns
- SimpleScheduleBuilder
the updated SimpleScheduleBuilder
- See Also
WithMisfireInstruction(SimpleTriggerMisfireInstruction)
Say what the trigger should do when it misses a firing.
public SimpleScheduleBuilder WithMisfireInstruction(SimpleTriggerMisfireInstruction instruction)
Parameters
instructionSimpleTriggerMisfireInstructionthe policy to apply. A builder never given one leaves the instruction unstated, and the scheduler's DefaultMisfireHandling decides it when the trigger is scheduled: SmartPolicy unless configured otherwise. Passing SmartPolicy states it, and the default then leaves it alone.
Returns
- SimpleScheduleBuilder
the updated SimpleScheduleBuilder
- See Also
WithRepeatCount(int)
Specify a the number of time the trigger will repeat - total number of firings will be this number + 1.
public SimpleScheduleBuilder WithRepeatCount(int repeatCount)
Parameters
repeatCountintthe number of times the trigger should repeat.
Returns
- SimpleScheduleBuilder
the updated SimpleScheduleBuilder
- See Also