Class RowWithErrorTargetBase<TDerived, TInputError>
An abstract dataflow worker which repeatedly executes the
OnInputRow(TInputError) method when there is an input row available
on the Input
port. It also has an ErrorOutput
port of the
same type as the Input
. The library user must inherit this class and override OnInputRow
to provide custom functionality.
OnInputRow(TInputError) is passed the row as a parameter, and does not itself take rows from the input port.
If the method throws an exception, the input row will be rejected to the ErrorOutput
port.
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 the availability of incoming rows.
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.
Use RowTargetBase<TDerived, TInput> if an error output port is not needed. Also see the RowTargetBase example.
Note: The input port uses the Default policy. Consider whether this is appropriate, or should be changed, see BufferingMode for further details.
Inheritance
Implements
Inherited Members
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public abstract class RowWithErrorTargetBase<TDerived, TInputError> : RowsTargetBase<TDerived, TInputError>, IDisposeOnFinished where TDerived : RowWithErrorTargetBase<TDerived, TInputError> where TInputError : class
Type Parameters
Name | Description |
---|---|
TDerived | The type of the derived worker. Class definition example:
|
TInputError | The type of each |
Constructors
RowWithErrorTargetBase(in DownstreamFactory<TInputError>, String)
Initializes a new instance of the RowWithErrorTargetBase<TDerived, TInputError>
abstract dataflow worker, which repeatedly executes the OnInputRow
method when there are
input rows available on the Input
port.
Declaration
protected RowWithErrorTargetBase(in DownstreamFactory<TInputError> downstreamFactory, string workerName)
Parameters
Type | Name | Description |
---|---|---|
DownstreamFactory<TInputError> | 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 |
---|---|
ArgumentException |
|
ArgumentNullException |
|
InvalidOperationException |
|
Properties
ErrorOutput
Gets the error output port for sending error rows to logging and an optional downstream worker.
Declaration
public ErrorOutputPort<TInputError> ErrorOutput { get; }
Property Value
Type | Description |
---|---|
ErrorOutputPort<TInputError> |
Methods
OnInputRow(TInputError)
An abstract method that gets called repeatedly when there is an input row available on the Input
port.
Override it and process each incoming row.
Declaration
protected abstract ProgressStatus OnInputRow(TInputError inputRow)
Parameters
Type | Name | Description |
---|---|---|
TInputError | inputRow | The incoming row. Guaranteed to not be |
Returns
Type | Description |
---|---|
ProgressStatus |
|
OnInputRowsAsync()
For internal use.
Declaration
protected sealed override Task<ProgressStatus> OnInputRowsAsync()
Returns
Type | Description |
---|---|
Task<ProgressStatus> |