Search Results for

    Show / Hide Table of Contents

    Class RowsTransformBase<TDerived, TInput, TOutput>

    An abstract dataflow worker which repeatedly executes the OnRowsAndDemandAsync() method when there is both data to consume from the upstream worker and RowsPerBuffer demand available from the downstream worker. The library user must inherit this class and override OnRowsAndDemandAsync to provide custom functionality.

    This class allows the developer to write synchronous or asynchronous code as needed, without having to check for output demand (which simplifies the implementation), as long as no more than RowsPerBuffer rows are sent on each invocation (without checking row demand explicitly).

    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.

    The input port uses the Default policy. Consider whether this is appropriate, or should be overridden, see BufferingMode for further details.

    Use RowsTransformBase<TDerived, TInput, TOutput, TError> instead if an ErrorOutput port is needed. Also see the RowsTransformBase example.

    Inheritance
    Object
    WorkerParent
    WorkerBase
    WorkerBase<TDerived>
    RowsTransformBase<TDerived, TInput, TOutput>
    RowsTransformBase<TDerived, TInput, TOutput, TError>
    RowTransformBase<TDerived, TInputError, 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.BytesPerRowBuffer
    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 RowsTransformBase<TDerived, TInput, TOutput> : WorkerBase<TDerived>, IDisposeOnFinished where TDerived : RowsTransformBase<TDerived, TInput, TOutput> where TInput : class where TOutput : class
    Type Parameters
    Name Description
    TDerived

    The type of the derived worker. Class definition example:

    public class MyTransform<TInput,TOutput>
        : RowsTransformBase<MyTransform<TInput,TOutput>,TInput,TOutput>
        where TInput : class
        where TOutput : class
    { 
        // ...
    }
    TInput

    The type of each Input row.

    TOutput

    The type of each Output row.

    Constructors

    RowsTransformBase(in DownstreamFactory<TInput>, String, Boolean)

    Initializes a new instance of the RowsTransformBase<TDerived, TInput, TOutput> abstract dataflow worker, which repeatedly executes a synchronous action when there is both data to consume from the upstream worker and RowsPerBuffer demand available from the downstream worker. The Output will be automatically completed, if needed.

    Declaration
    protected RowsTransformBase(in DownstreamFactory<TInput> downstreamFactory, string workerName, bool autoCompleteOutput)
    Parameters
    Type Name Description
    DownstreamFactory<TInput> downstreamFactory

    The downstream factory, which specifies the parent worker and (optionally) the upstream port to link the "first" input port of this dataflow worker to.

    Get it from Link when the upstream port is known ahead of time (which is usually the case). Otherwise get it from GetDownstreamFactory<TInput>(), and link the transform or target explicitly using LinkTo(InputPort<TOutput>) or LinkFrom(OutputPortBase<TInput>).

    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 "__".

    Boolean autoCompleteOutput
    • If set to true and the Output is not already completed after the final call to OnRowsAndDemandAsync(), it will be automatically completed according to the status returned by OnRowsAndDemandAsync() (or by any completed status from a AddStartingCallback(Func<WorkerBase, Task<ProgressStatus>>) callback).
    • If set to false, the Output must be completed by the library user in either OnRowsAndDemandAsync(), or in a AddRanCallback(Func<WorkerBase, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>) or AddCompletedCallback(Func<WorkerBase, OutcomeStatus, Task<OutcomeStatus>>) callback overload, or by overriding RunAsync().
    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

    Input

    Gets the input port for receiving rows from an upstream worker.

    Declaration
    public InputPort<TInput> Input { get; }
    Property Value
    Type Description
    InputPort<TInput>

    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

    OnRowsAndDemandAsync()

    An abstract method that gets called repeatedly when there is both data to consume from the upstream worker and RowsPerBuffer demand available from the downstream worker.

    Override it and call methods on the ports to input and output rows. Note that taking more rows than is available, or sending more rows than there is row demand will throw an exception.

    Declaration
    protected abstract Task<ProgressStatus> OnRowsAndDemandAsync()
    Returns
    Type Description
    Task<ProgressStatus>
    • NotCompleted to continue to be called when there are input rows available
    • Succeeded to discard all additional incoming rows, and successfully finish row processing and the worker.
    • Error or Fatal to fail the worker

    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 OnRowsAndDemandAsync() 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 © 2023 Envobi Ltd