Table of Contents

Class BaseJob

Namespace
Tlabs.JobCntrl.Model
Assembly
Tlabs.JobCntrl.dll

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

string

log

Job logger.

protected IJobLogger log

Field Value

IJobLogger

Properties

Log

Log logger.

public IJobLogger Log { get; }

Property Value

IJobLogger

ProcessingLog

Job's processing log.

public ILog ProcessingLog { get; }

Property Value

ILog

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

IJobResult

Type Parameters

TRes

CreateResult(bool)

Create a IJobResult with the success status.

protected IJobResult CreateResult(bool success)

Parameters

success bool

Returns

IJobResult

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

IJobResult

CreateResult(Exception)

Create a IJobResult from exception.

protected IJobResult CreateResult(Exception e)

Parameters

e Exception

Returns

IJobResult

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 string

Unique Job name/ID

description string

Job 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

IJobLogger

InternalInit()

Internal Job initalization.

protected abstract IJob InternalInit()

Returns

IJob

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

IJobResult

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>

Returns

IJobResult