Interface IJobDetail
- Namespace
- Quartz
- Assembly
- Quartz.dll
Conveys the detail properties of a given job instance. JobDetails are to be created/defined with JobBuilder.
public interface IJobDetail
- Extension Methods
Remarks
Quartz does not store an actual instance of a IJob type, but instead allows you to define an instance of one, through the use of a IJobDetail.
IJobs have a name and group associated with them, which should uniquely identify them within a single IScheduler.
ITrigger s are the 'mechanism' by which IJob s are scheduled. Many ITrigger s can point to the same IJob, but a single ITrigger can only point to one IJob.
The interface is implementable. Everything Quartz asks of a detail is declared here, including WithJobData(JobDataMap), which is how a job store re-stores the data of a PersistJobDataAfterExecutionAttribute job without having to rebuild the detail itself — a store cannot know how to construct an implementation it has never seen. How far such an implementation travels depends on the store:
- RAMJobStore holds the instances it is given and hands back copies of them, so a detail of your own round-trips as itself.
-
Anything that keeps a detail as data does not. The ADO.NET job store writes the columns of
QRTZ_JOB_DETAILSand rebuilds every detail it loads through JobBuilder, so what comes back is Quartz's own implementation; the HTTP client rebuilds one the same way from its wire payload. Whatever your type carries beyond the members declared here is gone by then, so anything that has to survive belongs in the JobDataMap.
Properties
ConcurrentExecutionDisallowed
Whether the associated Job class carries the DisallowConcurrentExecutionAttribute.
bool ConcurrentExecutionDisallowed { get; }
Property Value
- See Also
Description
Get or set the description given to the IJob instance by its creator (if any).
string? Description { get; }
Property Value
Durable
bool Durable { get; }
Property Value
Remarks
If not explicitly set, the default value is false.
JobDataMap
Get or set the JobDataMap that is associated with the IJob.
JobDataMap JobDataMap { get; }
Property Value
JobType
Get the instance of IJob that will be executed.
JobType JobType { get; }
Property Value
Key
The key that identifies this jobs uniquely.
JobKey Key { get; }
Property Value
PersistJobDataAfterExecution
Whether the associated Job class carries the PersistJobDataAfterExecutionAttribute.
bool PersistJobDataAfterExecution { get; }
Property Value
- See Also
RequestsRecovery
Set whether or not the IScheduler should re-Execute the IJob if a 'recovery' or 'fail-over' situation is encountered.
bool RequestsRecovery { get; }
Property Value
Remarks
If not explicitly set, the default value is false.
- See Also
Methods
Clone()
Returns a copy of this detail.
IJobDetail Clone()
Returns
Remarks
The copy is shallow, and its job data map is a shallow copy too: the map itself is a new one, so adding and removing entries in the copy leaves this detail's map alone, but the values in it are the same objects. Mutating a value read out of the copy's JobDataMap therefore mutates this detail's as well, which is worth knowing before cloning a detail to edit it. A store clones on the way in and on the way out, so what a caller holds is never the instance the store holds.
WithJobData(JobDataMap)
Return a detail like this one but carrying jobDataMap as its
JobDataMap, leaving this instance untouched.
IJobDetail WithJobData(JobDataMap jobDataMap)
Parameters
jobDataMapJobDataMapThe job data the returned detail carries.
Returns
Remarks
A job store calls this when a PersistJobDataAfterExecutionAttribute job finishes and the data it left behind has to become the data the next firing sees. It is the one mutation-shaped member on the interface, and it exists so that a store re-storing job data does not have to construct a detail itself — which it could only do as Quartz's own implementation, silently swapping out yours.
The map is taken as given rather than copied: the caller hands over a map it does not keep.