Quartz TriggerBuilder
Namespace: Quartz
Assembly: Quartz (in Quartz.dll) Version: 2.2.1.400
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);