Class JobBuilder
- Namespace
- Quartz
- Assembly
- Quartz.dll
JobBuilder is used to instantiate IJobDetails.
public static class JobBuilder
- Inheritance
-
JobBuilder
- Inherited Members
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 WithIdentity(..) a job 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.WithInterval(TimeSpan.FromHours(1)).RepeatForever())
.StartAt(DateTimeOffset.UtcNow.AddMinutes(10))
.Build();
scheduler.scheduleJob(job, trigger);
Methods
Create()
Create a JobBuilder with which to define a IJobDetail.
public static JobBuilder<IJob> Create()
Returns
- JobBuilder<IJob>
a new JobBuilder
Create<T>()
Create a JobBuilder for a known job type, with which to define a IJobDetail.
public static JobBuilder<T> Create<T>() where T : IJob
Returns
- JobBuilder<T>
a new JobBuilder
Type Parameters
T
Remarks
The job type stays with the builder, so job data can name the job's properties rather than spell their keys.