TriggerBuilder Class

Quartz.NET 3.0 API Documentation
TriggerBuilder is used to instantiate ITriggers.
Inheritance Hierarchy

SystemObject
  QuartzTriggerBuilder

Namespace:  Quartz
Assembly:  Quartz (in Quartz.dll) Version: 3.0.0
Syntax

C#
public class TriggerBuilder

The TriggerBuilder type exposes the following members.

Methods

  NameDescription
Public methodBuild
Produce the ITrigger.
Public methodStatic memberCreate
Create a new TriggerBuilder with which to define a specification for a Trigger.
Public methodEndAt
Set the time at which the Trigger will no longer fire - even if it's schedule has remaining repeats.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodForJob(String)
Set the identity of the Job which should be fired by the produced Trigger - a JobKey will be produced with the given name and default group.
Public methodForJob(IJobDetail)
Set the identity of the Job which should be fired by the produced Trigger, by extracting the JobKey from the given job.
Public methodForJob(JobKey)
Set the identity of the Job which should be fired by the produced Trigger.
Public methodForJob(String, String)
Set the identity of the Job which should be fired by the produced Trigger - a JobKey will be produced with the given name and group.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodModifiedByCalendar
Set the name of the ICalendar that should be applied to this Trigger's schedule.
Public methodStartAt
Set the time the Trigger should start at - the trigger may or may not fire at this time - depending upon the schedule configured for the Trigger. However the Trigger will NOT fire before this time, regardless of the Trigger's schedule.
Public methodStartNow
Set the time the Trigger should start at to the current moment - the trigger may or may not fire at this time - depending upon the schedule configured for the Trigger.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUsingJobData(JobDataMap)
Add the given key-value pair to the Trigger's JobDataMap.
Public methodUsingJobData(String, Boolean)
Add the given key-value pair to the Trigger's JobDataMap.
Public methodUsingJobData(String, Decimal)
Add the given key-value pair to the Trigger's JobDataMap.
Public methodUsingJobData(String, Double)
Add the given key-value pair to the Trigger's JobDataMap.
Public methodUsingJobData(String, Int32)
Add the given key-value pair to the Trigger's JobDataMap.
Public methodUsingJobData(String, Int64)
Add the given key-value pair to the Trigger's JobDataMap.
Public methodUsingJobData(String, Single)
Add the given key-value pair to the Trigger's JobDataMap.
Public methodUsingJobData(String, String)
Add the given key-value pair to the Trigger's JobDataMap.
Public methodWithDescription
Set the given (human-meaningful) description of the Trigger.
Public methodWithIdentity(String)
Use a TriggerKey with the given name and default group to identify the Trigger.
Public methodWithIdentity(TriggerKey)
Use the given TriggerKey to identify the Trigger.
Public methodWithIdentity(String, String)
Use a TriggerKey with the given name and group to identify the Trigger.
Public methodWithPriority
Set the Trigger's priority. When more than one Trigger have the same fire time, the scheduler will fire the one with the highest priority first.
Public methodWithSchedule
Set the IScheduleBuilder that will be used to define the Trigger's schedule.
Top
Extension Methods

  NameDescription
Public Extension MethodWithCalendarIntervalScheduleOverloaded. (Defined by CalendarIntervalTriggerBuilderExtensions.)
Public Extension MethodWithCalendarIntervalSchedule(ActionCalendarIntervalScheduleBuilder)Overloaded. (Defined by CalendarIntervalTriggerBuilderExtensions.)
Public Extension MethodWithCronSchedule(String)Overloaded. (Defined by CronScheduleTriggerBuilderExtensions.)
Public Extension MethodWithCronSchedule(String, ActionCronScheduleBuilder)Overloaded. (Defined by CronScheduleTriggerBuilderExtensions.)
Public Extension MethodWithDailyTimeIntervalScheduleOverloaded. (Defined by DailyTimeIntervalTriggerBuilderExtensions.)
Public Extension MethodWithDailyTimeIntervalSchedule(ActionDailyTimeIntervalScheduleBuilder)Overloaded. (Defined by DailyTimeIntervalTriggerBuilderExtensions.)
Public Extension MethodWithSimpleScheduleOverloaded. (Defined by SimpleScheduleTriggerBuilderExtensions.)
Public Extension MethodWithSimpleSchedule(ActionSimpleScheduleBuilder)Overloaded. (Defined by SimpleScheduleTriggerBuilderExtensions.)
Top
Remarks

The builder will always try to keep itself in a valid state, with reasonable defaults set for calling build() at any point. For instance if you do not invoke WithSchedule(..) method, a default schedule of firing once immediately will be used. As another example, if you do not invoked WithIdentity(..) a trigger name will be generated for you.

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
        .WithIntervalInHours(1)
        .RepeatForever())
    .StartAt(DateBuilder.FutureDate(10, IntervalUnit.Minute))
    .Build();
scheduler.scheduleJob(job, trigger);
See Also

Reference