Class RowsTargetBase<TDerived, TInput>
An abstract dataflow worker which repeatedly executes the
OnInput port. The library user must inherit this class and override
OnInputRowsAsync to provide custom functionality.
This class allows the developer to write synchronous or asynchronous code as needed,
without having to check for availability of input rows (which simplifies the implementation),
as long as more no rows than are available are taken (typically by taking multiple rows at
a time, e.g. via Take
The derived class can additionally override Runbase.RunAsync() must be called. The derived class (or its user) can also use
worker callbacks
to add logic.
Use RowsTargetBase<TDerived, TInput, TError> instead if an ErrorOutput port is needed.
Also see the
RowsTargetBase
example.
Note: The input port uses the Default policy. Consider
whether this is appropriate, or should be changed, see
Buffering
Inheritance
Implements
Inherited Members
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public abstract class RowsTargetBase<TDerived, TInput> : WorkerBase<TDerived>, IDisposeOnFinished where TDerived : RowsTargetBase<TDerived, TInput> where TInput : class
Type Parameters
| Name | Description |
|---|---|
| TDerived | The type of the derived worker. Class definition example:
|
| TInput | The type of each |
Constructors
RowsTargetBase(in DownstreamFactory<TInput>, String)
Initializes a new instance of the RowsTargetBase<TDerived, TInput>
abstract dataflow worker, which repeatedly executes the OnInputRowsAsync method when there are
input rows available on the Input port.
Declaration
protected RowsTargetBase(in DownstreamFactory<TInput> downstreamFactory, string workerName)
Parameters
| Type | Name | Description |
|---|---|---|
| Downstream |
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
While less useful, set to
The name cannot otherwise contain |
Exceptions
| Type | Condition |
|---|---|
| Argument |
|
| Argument |
|
| Invalid |
|
Properties
Input
Gets the input port for receiving rows from an upstream worker.
Declaration
public InputPort<TInput> Input { get; }
Property Value
| Type | Description |
|---|---|
| Input |
Methods
OnInputRowsAsync()
An abstract method that gets called repeatedly when there are input rows available on the Input port.
Override it and call methods on the Input port to consume rows from the upstream worker.
Declaration
protected abstract Task<ProgressStatus> OnInputRowsAsync()
Returns
| Type | Description |
|---|---|
| Task<Progress |
|
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 On
Declaration
protected override async Task<OutcomeStatus> RunAsync()
Returns
| Type | Description |
|---|---|
| Task<Outcome |
A |