C# Class Quartz.Simpl.PropertySettingJobFactory

A JobFactory that instantiates the Job instance (using the default no-arg constructor, or more specifically: ObjectUtils.InstantiateType{T}), and then attempts to set all values from the IJobExecutionContext and the IJobExecutionContext's merged JobDataMap onto properties of the job.
Set the WarnIfPropertyNotFound property to true if you'd like noisy logging in the case of values in the JobDataMap not mapping to properties on your job class. This may be useful for troubleshooting typos of property names, etc. but very noisy if you regularly (and purposely) have extra things in your JobDataMap. Also of possible interest is the ThrowIfPropertyNotFound property which will throw exceptions on unmatched JobDataMap keys.
Inheritance: Quartz.Simpl.SimpleJobFactory
显示文件 Open project: quartznet/quartznet Class Usage Examples

Public Methods

Method Description
NewJob ( Quartz.Spi.TriggerFiredBundle bundle, IScheduler scheduler ) : IJob

Called by the scheduler at the time of the trigger firing, in order to produce a IJob instance on which to call Execute.

It should be extremely rare for this method to throw an exception - basically only the case where there is no way at all to instantiate and prepare the Job for execution. When the exception is thrown, the Scheduler will move all triggers associated with the Job into the TriggerState.Error state, which will require human intervention (e.g. an application restart after fixing whatever configuration problem led to the issue with instantiating the Job).

SetObjectProperties ( object obj, JobDataMap data ) : void

Sets the object properties.

Protected Methods

Method Description
ConvertValueIfNecessary ( Type requiredType, object newValue ) : object

Private Methods

Method Description
HandleError ( string message ) : void
HandleError ( string message, Exception e ) : void

Method Details

ConvertValueIfNecessary() protected method

protected ConvertValueIfNecessary ( Type requiredType, object newValue ) : object
requiredType System.Type
newValue object
return object

NewJob() public method

Called by the scheduler at the time of the trigger firing, in order to produce a IJob instance on which to call Execute.

It should be extremely rare for this method to throw an exception - basically only the case where there is no way at all to instantiate and prepare the Job for execution. When the exception is thrown, the Scheduler will move all triggers associated with the Job into the TriggerState.Error state, which will require human intervention (e.g. an application restart after fixing whatever configuration problem led to the issue with instantiating the Job).

public NewJob ( Quartz.Spi.TriggerFiredBundle bundle, IScheduler scheduler ) : IJob
bundle Quartz.Spi.TriggerFiredBundle The TriggerFiredBundle from which the /// and other info relating to the trigger firing can be obtained.
scheduler IScheduler
return IJob

SetObjectProperties() public method

Sets the object properties.
public SetObjectProperties ( object obj, JobDataMap data ) : void
obj object The object to set properties to.
data JobDataMap The data to set.
return void