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.
Implements
Inherited Members
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:
|
TOutput | The type of each |
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 |
String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
Func<Boolean> | isStartableFunc | Function to calculate the worker start constraint; it should return |
Exceptions
Type | Condition |
---|---|
ArgumentException |
|
ArgumentNullException |
|
InvalidOperationException |
|
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 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 |