Search Results for

    Show / Hide Table of Contents

    Class RowSourceBase<TDerived, TOutput>

    An abstract dataflow worker which repeatedly executes the OnOutputRowDemand() method when there is demand on the Output port. The library user must inherit this class and override OnOutputRowDemand() to provide custom functionality.

    This class simplifies the implementation by allowing the developer to write synchronous code that operates on a single row at a time, without having to check for output demand.

    The derived class can additionally override RunAsync() to add logic that runs before and after all processing of rows, in which case the base class base.RunAsync() must be called. The derived class (or its user) can also use worker callbacks to add logic.

    Also see the RowSourceBase example.

    Inheritance
    Object
    WorkerParent
    WorkerBase
    WorkerBase<TDerived>
    RowSourceBase<TDerived, TOutput>
    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 RowSourceBase<TDerived, TOutput> : WorkerBase<TDerived>, IDisposeOnFinished where TDerived : RowSourceBase<TDerived, TOutput> where TOutput : class
    Type Parameters
    Name Description
    TDerived

    The type of the derived worker. Class definition example:

    public class MySource<TOutput>
        : RowSourceBase<MySource<TOutput>,TOutput>
        where TOutput : class, new()
    { 
        // ...
    }
    TOutput

    The type of each Output row.

    Constructors

    RowSourceBase(WorkerParent, String, Func<Boolean>)

    Initializes a new instance of the RowSourceBase<TDerived, TOutput> abstract dataflow worker, which repeatedly executes the OnOutputRowDemand() method when there is demand on the Output port.

    Declaration
    protected RowSourceBase(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc)
    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.

    Exceptions
    Type Condition
    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?

    Properties

    Output

    Gets the output port for sending rows to the downstream worker.

    Declaration
    public OutputPort<TOutput> Output { get; }
    Property Value
    Type Description
    OutputPort<TOutput>

    Methods

    OnOutputRowDemand()

    An abstract method that gets called repeatedly when there is demand for one more row on the Output port. Override it and produce zero or one output rows per invocation.

    Note that this method must not send rows by calling methods directly on the Output port.

    Declaration
    protected abstract ProgressStatusResult<TOutput> OnOutputRowDemand()
    Returns
    Type Description
    ProgressStatusResult<TOutput>

    In the returned ProgressStatusResult<TResult>, set Status to:

    • NotCompleted to continue to be called when there is demand for rows
    • Succeeded to finish row processing and (if not already completed) automatically call SendSucceeded() to complete the Output port
    • An error status to fail the Output port (if not already completed) and the worker
    For NotCompleted and Succeeded, also set Result to either a row to be sent to the output, or null to not send a row.

    RunAsync()

    This method can be overridden to add custom functionality to the derived worker that runs before and after the row processing. In this case, the base class base.RunAsync() must be called for the worker to function correctly.

    Typically, only OnOutputRowDemand() is overridden to add required custom logic.

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

    A Task 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 © 2021 Envobi Ltd