Class BaseJob
Abstract Job base class.
public abstract class BaseJob : BaseModel, IJob, IModel, IDisposable
- Inheritance
-
BaseJob
- Implements
- Inherited Members
- Extension Methods
Remarks
Convenients base class for implementators of the IJob interface.
Constructors
BaseJob()
protected BaseJob()
Fields
PROP_LOGLEVEL
Log-level property name.
public const string PROP_LOGLEVEL = "Log-Level"
Field Value
log
Job logger.
protected IJobLogger log
Field Value
Properties
Log
Log logger.
public IJobLogger Log { get; }
Property Value
ProcessingLog
Job's processing log.
public ILog ProcessingLog { get; }
Property Value
Methods
CreateAsyncResult<TRes>(Task<TRes>, Func<TRes, IJobResult>)
Create async IJobResult from resTsk
with callback buildJobResult
.
protected IJobResult CreateAsyncResult<TRes>(Task<TRes> resTsk, Func<TRes, IJobResult> buildJobResult)
Parameters
resTsk
Task<TRes>buildJobResult
Func<TRes, IJobResult>
Returns
Type Parameters
TRes
CreateResult(bool)
Create a IJobResult with the success status.
protected IJobResult CreateResult(bool success)
Parameters
success
bool
Returns
CreateResult(IReadOnlyDictionary<string, object?>, string?)
Create a IJobResult with resultObjs
and (optional) message
.
protected IJobResult CreateResult(IReadOnlyDictionary<string, object?> resultObjs, string? message = null)
Parameters
resultObjs
IReadOnlyDictionary<string, object>message
string
Returns
CreateResult(Exception)
Create a IJobResult from exception.
protected IJobResult CreateResult(Exception e)
Parameters
Returns
DumpLog(BaseJob)
Dump Job log to standard out stream (console).
public static void DumpLog(BaseJob job)
Parameters
job
BaseJob
DumpLog(ILog)
Dump log to standard out stream (console).
public static void DumpLog(ILog log)
Parameters
log
ILog
Initialize(string, string?, IReadOnlyDictionary<string, object?>?)
Initialize a Job
public IJob Initialize(string name, string? description, IReadOnlyDictionary<string, object?>? properties)
Parameters
name
stringUnique Job name/ID
description
stringJob description
properties
IReadOnlyDictionary<string, object>Properties dictionary
Returns
- IJob
this. (Utility to create instances like:
var Job= new Job().Initialize(name, description, properties);
)
InternalCreateLogger()
Create a IJobLogger implementation.
protected virtual IJobLogger InternalCreateLogger()
Returns
InternalInit()
Internal Job initalization.
protected abstract IJob InternalInit()
Returns
Remarks
Called from Initialize()
after name, description and properties have been set. Implementations
should use this method to initialize non-property specific Job state.
Note: The final set of Job properties is available only at the actual Job run, where additional run properties from the starter activation might be specified.
InternalRun(IReadOnlyDictionary<string, object?>)
Internal Job run method.
protected abstract IJobResult InternalRun(IReadOnlyDictionary<string, object?> runProperties)
Parameters
runProperties
IReadOnlyDictionary<string, object>Properties dictionary already containing all properties (merged with run-properties).
Note: Other than the Properties, the "/>runProperties
are not read-only.
Returns
Remarks
To be implemented with Job functionality.
Run(IReadOnlyDictionary<string, object?>)
Run Job
public IJobResult Run(IReadOnlyDictionary<string, object?> props)
Parameters
props
IReadOnlyDictionary<string, object>