Search Results for

    Show / Hide Table of Contents

    Class ActionWorkerBase<TDerived>

    An abstract worker which accepts a callback to specify what it should do, which can include creating child workers.

    This class must be inherited. The most common use case is to create a custom worker where the user supplies a callback that the custom worker will execute, and the custom worker also overrides RunAsync() to add additional logic. Note that when overriding this RunAsync(), the base class base.RunAsync() must be called.

    Inheritance
    Object
    WorkerParent
    WorkerBase
    WorkerBase<TDerived>
    ActionWorkerBase<TDerived>
    ActionSource<TOutput>
    ActionSource<TOutput, TError>
    ActionTarget<TInput>
    ActionTarget<TInput, TError>
    ActionTransform<TInputOutputError>
    ActionTransform<TInputError, TOutput>
    ActionTwoInputTransform<TLeftInput, TRightInput, TOutput>
    ActionWorker
    Implements
    IDisposeOnFinished
    Inherited Members
    WorkerBase<TDerived>.AddCompletedCallback(Func<TDerived, OutcomeStatus, Task<OutcomeStatus>>)
    WorkerBase<TDerived>.AddRanCallback(Func<TDerived, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
    WorkerBase<TDerived>.AddStartingCallback(Func<TDerived, Task<ProgressStatus>>)
    WorkerBase.AddCompletedCallback(Func<WorkerBase, OutcomeStatus, Task<OutcomeStatus>>)
    WorkerBase.AddRanCallback(Func<WorkerBase, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
    WorkerBase.AddStartingCallback(Func<WorkerBase, Task<ProgressStatus>>)
    WorkerBase.DefaultIsStartable()
    WorkerBase.ErroredPortErrorsWorkerProtected
    WorkerBase.ErrorOutputs
    WorkerBase.EscalateError
    WorkerBase.Inputs
    WorkerBase.IsStartable
    WorkerBase.Outputs
    WorkerBase.Parent
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, WorkerBase, WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(TLastWorker)
    WorkerParent.AddChildCompletedCallback(Action<WorkerBase>)
    WorkerParent.AddStartingChildrenCallback(Func<WorkerParent, Task<ProgressStatus>>)
    WorkerParent.Children
    WorkerParent.DisposeOnFinished<TDisposable>(TDisposable)
    WorkerParent.GetDownstreamFactory<TInput>()
    WorkerParent.HasChildren
    WorkerParent.IsCanceled
    WorkerParent.IsCompleted
    WorkerParent.IsCreated
    WorkerParent.IsError
    WorkerParent.IsFailed
    WorkerParent.IsFatal
    WorkerParent.IsRunning
    WorkerParent.IsSucceeded
    WorkerParent.KeepChildrenLevels
    WorkerParent.Locator
    WorkerParent.LogFactory
    WorkerParent.Logger
    WorkerParent.MaxRunningChildren
    WorkerParent.Name
    WorkerParent.RemoveChildren()
    WorkerParent.RescheduleChildren()
    WorkerParent.RunChildrenAsync(Boolean)
    WorkerParent.RunChildrenAsync()
    WorkerParent.Status
    WorkerParent.Item[String]
    WorkerParent.ToString()
    WorkerParent.WorkerSystem
    WorkerParent.DebugCommands
    WorkerParent.AggregateErrorOutputRows
    WorkerParent.AggregateOutputRows
    WorkerParent.AggregateWorkersCompleted
    WorkerParent.InstantCompleted
    WorkerParent.InstantCreated
    WorkerParent.InstantStarted
    WorkerParent.RunningDuration
    Namespace: actionETL
    Assembly: actionETL.dll
    Syntax
    public abstract class ActionWorkerBase<TDerived> : WorkerBase<TDerived>, IDisposeOnFinished where TDerived : ActionWorkerBase<TDerived>
    Type Parameters
    Name Description
    TDerived

    The type of the derived worker, which will be passed as a parameter to the anonymous method. Class definition example:

    public class MyWorker
        : ActionWorkerBase<MyWorker>
    { 
        // ...
    }

    Constructors

    ActionWorkerBase(WorkerParent, String, Func<Boolean>, Action<TDerived>)

    Initializes a new instance of the ActionWorkerBase<TDerived> abstract worker that will execute a synchronous action.

    Declaration
    protected ActionWorkerBase(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Action<TDerived> action)
    Parameters
    Type Name Description
    WorkerParent workerParent

    The parent worker or worker system that the new child worker will be added to. Cannot be null.

    String workerName

    Name of the worker.

    Set to a prefix plus a trailing "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Func<Boolean> isStartableFunc

    Function to calculate the worker start constraint; it should return true for startable and false for not startable. Defaults to startable if null.

    Action<TDerived> action

    The synchronous action to execute, optionally creating child workers.

    Exceptions
    Type Condition
    ArgumentNullException

    action

    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    ArgumentNullException

    workerParent - All workers must have a parent. The top level workers have the worker system as parent.

    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    ActionWorkerBase(WorkerParent, String, Func<Boolean>, Func<TDerived, OutcomeStatus>)

    Initializes a new instance of the ActionWorkerBase<TDerived> abstract worker that will execute a synchronous function.

    Declaration
    protected ActionWorkerBase(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Func<TDerived, OutcomeStatus> func)
    Parameters
    Type Name Description
    WorkerParent workerParent

    The parent worker or worker system that the new child worker will be added to. Cannot be null.

    String workerName

    Name of the worker.

    Set to a prefix plus a trailing "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Func<Boolean> isStartableFunc

    Function to calculate the worker start constraint; it should return true for startable and false for not startable. Defaults to startable if null.

    Func<TDerived, OutcomeStatus> func

    The synchronous function to execute, optionally creating child workers.

    Exceptions
    Type Condition
    ArgumentNullException

    func

    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    ArgumentNullException

    workerParent - All workers must have a parent. The top level workers have the worker system as parent.

    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    ActionWorkerBase(WorkerParent, String, Func<Boolean>, Func<TDerived, Task<OutcomeStatus>>)

    Initializes a new instance of the ActionWorkerBase<TDerived> abstract worker that will execute an asynchronous function.

    Declaration
    protected ActionWorkerBase(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Func<TDerived, Task<OutcomeStatus>> funcAsync)
    Parameters
    Type Name Description
    WorkerParent workerParent

    The parent worker or worker system that the new child worker will be added to. Cannot be null.

    String workerName

    Name of the worker.

    Set to a prefix plus a trailing "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Func<Boolean> isStartableFunc

    Function to calculate the worker start constraint; it should return true for startable and false for not startable. Defaults to startable if null.

    Func<TDerived, Task<OutcomeStatus>> funcAsync

    The asynchronous function to execute, optionally creating child workers.

    Exceptions
    Type Condition
    ArgumentNullException

    funcAsync

    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    ArgumentNullException

    workerParent - All workers must have a parent. The top level workers have the worker system as parent.

    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    ActionWorkerBase(WorkerParent, String, Func<Boolean>, Func<TDerived, Task>)

    Initializes a new instance of the ActionWorkerBase<TDerived> abstract worker that will execute an asynchronous action.

    Declaration
    protected ActionWorkerBase(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Func<TDerived, Task> actionAsync)
    Parameters
    Type Name Description
    WorkerParent workerParent

    The parent worker or worker system that the new child worker will be added to. Cannot be null.

    String workerName

    Name of the worker.

    Set to a prefix plus a trailing "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Func<Boolean> isStartableFunc

    Function to calculate the worker start constraint; it should return true for startable and false for not startable. Defaults to startable if null.

    Func<TDerived, Task> actionAsync

    The asynchronous action to execute, optionally creating child workers.

    Exceptions
    Type Condition
    ArgumentNullException

    actionAsync

    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    ArgumentNullException

    workerParent - All workers must have a parent. The top level workers have the worker system as parent.

    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    Methods

    RunAsync()

    Calls the user supplied callback.

    This method is called by the system during the worker Running phase. It can be overridden to add custom functionality to the derived worker, in which case the base class base.RunAsync() must be called for the worker to function correctly.

    Note that the worker Running phase also includes additional places where logic can optionally be inserted via callbacks, to e.g. customize the initialization, cleanup, and error handling of existing workers. This is mostly used when customizing workers that are not designed to be derived from (i.e. without a "Base" suffix). See Worker Life-cycle for details.

    Declaration
    protected override Task<OutcomeStatus> RunAsync()
    Returns
    Type Description
    Task<OutcomeStatus>

    A Task<TResult> describing the success or failure of the worker. An asynchronous async implementation would e.g. return OutcomeStatus.Succeeded on success, while a synchronous implementation would return OutcomeStatus.SucceededTask.

    Overrides
    WorkerParent.RunAsync()

    Implements

    IDisposeOnFinished
    In This Article
    Back to top Copyright © 2020 Envobi Ltd