Class RowsActionSource<TOutput>
A dataflow worker with one output port
which repeatedly executes a function when there is RowsPerBuffer
demand on the Output port.
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.
Also see the RowsActionSource example.
The user supplied function calls methods on the Output port to pass data to the
downstream worker, until it returns:
ProgressStatus.NotCompletedto wait for at least RowsPerBufferOutputdemand.ProgressStatus.Succeededto stop producing rows. If theOutputport is not completed, the library will call SendSucceeded() to complete it.ProgressStatus.ErrororProgressStatus.Fatalto fail the worker. If theOutputport is not completed, the library will call SendError(String) to complete it.
Implements
Inherited Members
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public class RowsActionSource<TOutput> : WorkerBase<RowsActionSource<TOutput>>, IDisposeOnFinished where TOutput : class
Type Parameters
| Name | Description |
|---|---|
| TOutput | The type of each |
Constructors
RowsActionSource(WorkerParent, String, Func<RowsActionSource<TOutput>, ProgressStatus>)
Initializes a new instance of the RowsActionSource<TOutput>
dataflow worker which repeatedly executes a synchronous outputDemandFunc
function when there is RowsPerBuffer demand on the Output port.
The Output will be automatically completed, if needed.
Declaration
public RowsActionSource(WorkerParent workerParent, string workerName, Func<RowsActionSource<TOutput>, ProgressStatus> outputDemandFunc)
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<RowsActionSource<TOutput>, ProgressStatus> | outputDemandFunc | A synchronous function that is called repeatedly when there is
RowsPerBuffer demand available from the downstream worker.
The function in turn creates new rows and calls methods on the
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
RowsActionSource(WorkerParent, String, Func<RowsActionSource<TOutput>, Task<ProgressStatus>>)
Initializes a new instance of the RowsActionSource<TOutput>
dataflow worker which repeatedly executes a asynchronous outputDemandFuncAsync
function when there is RowsPerBuffer demand on the Output port.
The Output will be automatically completed, if needed.
Declaration
public RowsActionSource(WorkerParent workerParent, string workerName, Func<RowsActionSource<TOutput>, Task<ProgressStatus>> outputDemandFuncAsync)
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<RowsActionSource<TOutput>, Task<ProgressStatus>> | outputDemandFuncAsync | An asynchronous function that is called repeatedly when there is
RowsPerBuffer demand available from the downstream worker.
The function in turn creates new rows and calls methods on the
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
RowsActionSource(WorkerParent, String, Func<RowsActionSource<TOutput>, Task<ProgressStatus>>, Func<RowsActionSource<TOutput>, ProgressStatus>, Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
Initializes a new instance of the RowsActionSource<TOutput>
dataflow worker which repeatedly executes a synchronous outputDemandFunc
function when there is RowsPerBuffer demand on the Output port.
Declaration
public RowsActionSource(WorkerParent workerParent, string workerName, Func<RowsActionSource<TOutput>, Task<ProgressStatus>> startingFuncAsync, Func<RowsActionSource<TOutput>, ProgressStatus> outputDemandFunc, Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>> ranFuncAsync)
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<RowsActionSource<TOutput>, Task<ProgressStatus>> | startingFuncAsync | A function that will be called before the row processing starts, ignored if
|
| Func<RowsActionSource<TOutput>, ProgressStatus> | outputDemandFunc | A synchronous function that is called repeatedly when there is
RowsPerBuffer demand available from the downstream worker.
The function in turn creates new rows and calls methods on the
|
| Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>> | ranFuncAsync | A function that will be called after any
null to return the same OutcomeStatus that was passed in,
after (if needed) completing the Output port according to the
OutcomeStatus.
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
RowsActionSource(WorkerParent, String, Func<RowsActionSource<TOutput>, Task<ProgressStatus>>, Func<RowsActionSource<TOutput>, Task<ProgressStatus>>, Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
Initializes a new instance of the RowsActionSource<TOutput>
dataflow worker which repeatedly executes a asynchronous outputDemandFuncAsync
function when there is RowsPerBuffer demand on the Output port.
Declaration
public RowsActionSource(WorkerParent workerParent, string workerName, Func<RowsActionSource<TOutput>, Task<ProgressStatus>> startingFuncAsync, Func<RowsActionSource<TOutput>, Task<ProgressStatus>> outputDemandFuncAsync, Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>> ranFuncAsync)
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<RowsActionSource<TOutput>, Task<ProgressStatus>> | startingFuncAsync | A function that will be called before the row processing starts, ignored if
|
| Func<RowsActionSource<TOutput>, Task<ProgressStatus>> | outputDemandFuncAsync | An asynchronous function that is called repeatedly when there is
RowsPerBuffer demand available from the downstream worker.
The function in turn creates new rows and calls methods on the
|
| Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>> | ranFuncAsync | A function that will be called after any
null to return the same OutcomeStatus that was passed in,
after (if needed) completing the Output port according to the
OutcomeStatus.
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
RowsActionSource(WorkerParent, String, Func<Boolean>, Func<RowsActionSource<TOutput>, ProgressStatus>)
Initializes a new instance of the RowsActionSource<TOutput>
dataflow worker which repeatedly executes a synchronous outputDemandFunc
function when there is RowsPerBuffer demand on the Output port.
The Output will be automatically completed, if needed.
Declaration
public RowsActionSource(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Func<RowsActionSource<TOutput>, ProgressStatus> outputDemandFunc)
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 |
| Func<RowsActionSource<TOutput>, ProgressStatus> | outputDemandFunc | A synchronous function that is called repeatedly when there is
RowsPerBuffer demand available from the downstream worker.
The function in turn creates new rows and calls methods on the
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
RowsActionSource(WorkerParent, String, Func<Boolean>, Func<RowsActionSource<TOutput>, Task<ProgressStatus>>)
Initializes a new instance of the RowsActionSource<TOutput>
dataflow worker which repeatedly executes a asynchronous outputDemandFuncAsync
function when there is RowsPerBuffer demand on the Output port.
The Output will be automatically completed, if needed.
Declaration
public RowsActionSource(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Func<RowsActionSource<TOutput>, Task<ProgressStatus>> outputDemandFuncAsync)
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 |
| Func<RowsActionSource<TOutput>, Task<ProgressStatus>> | outputDemandFuncAsync | An asynchronous function that is called repeatedly when there is
RowsPerBuffer demand available from the downstream worker.
The function in turn creates new rows and calls methods on the
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
RowsActionSource(WorkerParent, String, Func<Boolean>, Func<RowsActionSource<TOutput>, Task<ProgressStatus>>, Func<RowsActionSource<TOutput>, ProgressStatus>, Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
Initializes a new instance of the RowsActionSource<TOutput>
dataflow worker which repeatedly executes a synchronous outputDemandFunc
function when there is RowsPerBuffer demand on the Output port.
Declaration
public RowsActionSource(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Func<RowsActionSource<TOutput>, Task<ProgressStatus>> startingFuncAsync, Func<RowsActionSource<TOutput>, ProgressStatus> outputDemandFunc, Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>> ranFuncAsync)
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 |
| Func<RowsActionSource<TOutput>, Task<ProgressStatus>> | startingFuncAsync | A function that will be called before the row processing starts, ignored if
|
| Func<RowsActionSource<TOutput>, ProgressStatus> | outputDemandFunc | A synchronous function that is called repeatedly when there is
RowsPerBuffer demand available from the downstream worker.
The function in turn creates new rows and calls methods on the
|
| Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>> | ranFuncAsync | A function that will be called after any
null to return the same OutcomeStatus that was passed in,
after (if needed) completing the Output port according to the
OutcomeStatus.
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
RowsActionSource(WorkerParent, String, Func<Boolean>, Func<RowsActionSource<TOutput>, Task<ProgressStatus>>, Func<RowsActionSource<TOutput>, Task<ProgressStatus>>, Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
Initializes a new instance of the RowsActionSource<TOutput>
dataflow worker which repeatedly executes a asynchronous outputDemandFuncAsync
function when there is RowsPerBuffer demand on the Output port.
Declaration
public RowsActionSource(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Func<RowsActionSource<TOutput>, Task<ProgressStatus>> startingFuncAsync, Func<RowsActionSource<TOutput>, Task<ProgressStatus>> outputDemandFuncAsync, Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>> ranFuncAsync)
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 |
| Func<RowsActionSource<TOutput>, Task<ProgressStatus>> | startingFuncAsync | A function that will be called before the row processing starts, ignored if
|
| Func<RowsActionSource<TOutput>, Task<ProgressStatus>> | outputDemandFuncAsync | An asynchronous function that is called repeatedly when there is
RowsPerBuffer demand available from the downstream worker.
The function in turn creates new rows and calls methods on the
|
| Func<RowsActionSource<TOutput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>> | ranFuncAsync | A function that will be called after any
null to return the same OutcomeStatus that was passed in,
after (if needed) completing the Output port according to the
OutcomeStatus.
|
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| 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
RunAsync()
This method can be overridden to add custom functionality to the derived worker that runs before
and after the row processing, but after
AddStartingCallback(Func<WorkerBase, Task<ProgressStatus>>) and before
AddRanCallback(Func<WorkerBase, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>).
In this case, the base class base.RunAsync()
must be called for the worker to function correctly.
Typically, this worker is used without overriding this method.
Declaration
protected override async Task<OutcomeStatus> RunAsync()
Returns
| Type | Description |
|---|---|
| Task<OutcomeStatus> | A |