Table of Contents

Class TriggerConfiguratorExtensions

Namespace
Quartz
Assembly
Quartz.dll

Gives a trigger its schedule, one method per schedule kind.

public static class TriggerConfiguratorExtensions
Inheritance
TriggerConfiguratorExtensions
Inherited Members

Remarks

Each method is generic in the receiver and returns it unchanged, so the chain keeps whatever type it started with — TriggerBuilder<TJob> when building a trigger directly, ITriggerConfigurator<TJob> when configuring one through the container — and the two read identically.

Every kind offers the same two shapes: configure a fresh builder inline, or hand over one that was built elsewhere.

Methods

WithCalendarIntervalSchedule<TConfigurator>(TConfigurator, CalendarIntervalScheduleBuilder)

Set the trigger to fire on the given calendar-interval schedule.

public static TConfigurator WithCalendarIntervalSchedule<TConfigurator>(this TConfigurator configurator, CalendarIntervalScheduleBuilder schedule) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

schedule CalendarIntervalScheduleBuilder

the schedule to use.

Returns

TConfigurator

Type Parameters

TConfigurator

WithCalendarIntervalSchedule<TConfigurator>(TConfigurator, Action<CalendarIntervalScheduleBuilder>?)

Set the trigger to fire on a calendar interval — one that counts days, weeks, months or years rather than a fixed amount of time.

public static TConfigurator WithCalendarIntervalSchedule<TConfigurator>(this TConfigurator configurator, Action<CalendarIntervalScheduleBuilder>? configure = null) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

configure Action<CalendarIntervalScheduleBuilder>

configures the schedule.

Returns

TConfigurator

Type Parameters

TConfigurator

WithCronSchedule<TConfigurator>(TConfigurator, CronExpression, Action<CronScheduleBuilder>?)

Set the trigger to fire on a cron schedule defined by an already-built CronExpression.

public static TConfigurator WithCronSchedule<TConfigurator>(this TConfigurator configurator, CronExpression cronExpression, Action<CronScheduleBuilder>? configure = null) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

cronExpression CronExpression

the cron expression the trigger fires on.

configure Action<CronScheduleBuilder>

configures the rest of the schedule, such as its time zone.

Returns

TConfigurator

Type Parameters

TConfigurator

Remarks

This is also the overload to reach for when the expression carries H (hash) tokens that should be spread by something other than the trigger's own key: WithCronSchedule(CronExpression.ParseWithHash(expression, hashKey)).

WithCronSchedule<TConfigurator>(TConfigurator, CronExpressionBuilder, Action<CronScheduleBuilder>?)

Set the trigger to fire on a cron schedule assembled with a CronExpressionBuilder, so the fluent chain closes without naming CronScheduleBuilder.

public static TConfigurator WithCronSchedule<TConfigurator>(this TConfigurator configurator, CronExpressionBuilder cronExpression, Action<CronScheduleBuilder>? configure = null) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

cronExpression CronExpressionBuilder

the builder holding the assembled expression; it is built here.

configure Action<CronScheduleBuilder>

configures the rest of the schedule, such as its time zone.

Returns

TConfigurator

Type Parameters

TConfigurator

WithCronSchedule<TConfigurator>(TConfigurator, CronScheduleBuilder)

Set the trigger to fire on the given cron schedule.

public static TConfigurator WithCronSchedule<TConfigurator>(this TConfigurator configurator, CronScheduleBuilder schedule) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

schedule CronScheduleBuilder

the schedule to use.

Returns

TConfigurator

Type Parameters

TConfigurator

Remarks

The narrowest of the four, and the one that looks most like WithSchedule with a smaller parameter — which it is. It stays because every With…Schedule family has this member, so removing it from cron alone would leave one family short of the shape the other four teach, and because it is the 3.x spelling a migrating application already has. The other three each say something WithSchedule cannot: parse a string, take an expression already parsed (which is where a hash key rides), or close a CronExpressionBuilder chain — and all three also apply the configure callback.

WithCronSchedule<TConfigurator>(TConfigurator, string, Action<CronScheduleBuilder>?)

Set the trigger to fire on a cron schedule.

public static TConfigurator WithCronSchedule<TConfigurator>(this TConfigurator configurator, string cronExpression, Action<CronScheduleBuilder>? configure = null) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

cronExpression string

the cron expression the trigger fires on.

configure Action<CronScheduleBuilder>

configures the rest of the schedule, such as its time zone.

Returns

TConfigurator

Type Parameters

TConfigurator

WithDailyTimeIntervalSchedule<TConfigurator>(TConfigurator, DailyTimeIntervalScheduleBuilder)

Set the trigger to fire on the given daily-time-interval schedule.

public static TConfigurator WithDailyTimeIntervalSchedule<TConfigurator>(this TConfigurator configurator, DailyTimeIntervalScheduleBuilder schedule) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

schedule DailyTimeIntervalScheduleBuilder

the schedule to use.

Returns

TConfigurator

Type Parameters

TConfigurator

WithDailyTimeIntervalSchedule<TConfigurator>(TConfigurator, Action<DailyTimeIntervalScheduleBuilder>?)

Set the trigger to fire one or more times a day, within a daily time window.

public static TConfigurator WithDailyTimeIntervalSchedule<TConfigurator>(this TConfigurator configurator, Action<DailyTimeIntervalScheduleBuilder>? configure = null) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

configure Action<DailyTimeIntervalScheduleBuilder>

configures the schedule.

Returns

TConfigurator

Type Parameters

TConfigurator

Remarks

The interval decides how often the trigger fires inside the window. For a single execution per day, call EndingDailyAfterCount(int) with 1 or set the interval to cover the whole window.

WithRecurrenceSchedule<TConfigurator>(TConfigurator, RecurrenceScheduleBuilder)

Set the trigger to use the given RFC 5545 RRULE-based schedule.

public static TConfigurator WithRecurrenceSchedule<TConfigurator>(this TConfigurator configurator, RecurrenceScheduleBuilder schedule) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

schedule RecurrenceScheduleBuilder

the schedule to use.

Returns

TConfigurator

Type Parameters

TConfigurator

WithRecurrenceSchedule<TConfigurator>(TConfigurator, string, Action<RecurrenceScheduleBuilder>?)

Set the trigger to use an RFC 5545 RRULE-based schedule.

public static TConfigurator WithRecurrenceSchedule<TConfigurator>(this TConfigurator configurator, string recurrenceRule, Action<RecurrenceScheduleBuilder>? configure = null) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

recurrenceRule string

An RFC 5545 RRULE string, e.g. "FREQ=WEEKLY;INTERVAL=2;BYDAY=MO,WE,FR".

configure Action<RecurrenceScheduleBuilder>

configures the rest of the schedule, such as its time zone.

Returns

TConfigurator

Type Parameters

TConfigurator

WithSimpleSchedule<TConfigurator>(TConfigurator, SimpleScheduleBuilder)

Set the trigger to fire on the given fixed-interval schedule.

public static TConfigurator WithSimpleSchedule<TConfigurator>(this TConfigurator configurator, SimpleScheduleBuilder schedule) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

schedule SimpleScheduleBuilder

the schedule to use.

Returns

TConfigurator

Type Parameters

TConfigurator

WithSimpleSchedule<TConfigurator>(TConfigurator, Action<SimpleScheduleBuilder>?)

Set the trigger to fire on a fixed interval, optionally repeating.

public static TConfigurator WithSimpleSchedule<TConfigurator>(this TConfigurator configurator, Action<SimpleScheduleBuilder>? configure = null) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

configure Action<SimpleScheduleBuilder>

configures the schedule; omit for a schedule that fires once.

Returns

TConfigurator

Type Parameters

TConfigurator

WithSimpleSchedule<TConfigurator>(TConfigurator, TimeSpan, int?)

Set the trigger to fire on a fixed interval, repeating forever unless a repeat count is given.

public static TConfigurator WithSimpleSchedule<TConfigurator>(this TConfigurator configurator, TimeSpan interval, int? repeatCount = null) where TConfigurator : ITriggerConfigurator

Parameters

configurator TConfigurator

the trigger being configured.

interval TimeSpan

the interval at which the trigger repeats.

repeatCount int?

How many times the trigger repeats after its first firing, so the total number of firings is one more than this — the same number WithRepeatCount(int) and RepeatCount carry, with no arithmetic of its own. null, the default, repeats forever.

Returns

TConfigurator

Type Parameters

TConfigurator

Remarks

The shorthand for the schedule almost every fixed-interval trigger wants, so that WithSimpleSchedule(x => x.WithInterval(interval).RepeatForever()) can be written WithSimpleSchedule(interval). Reach for the delegate overload when the schedule needs more than an interval and a count — a misfire instruction, say.