Class ActionWorker
A worker which accepts a callback to specify what it should do, which can include creating child workers.
It can also be configured as a worker that always fails, which is sometimes useful:
new ActionWorker(parent, "Always Fail", aw => OutcomeStatus.Error);
This class is sealed. ActionWorkerBase<TDerived> is available to derive from.
Inheritance
Implements
Inherited Members
Namespace: actionETL
Assembly: actionETL.dll
Syntax
public sealed class ActionWorker : ActionWorkerBase<ActionWorker>, IDisposeOnFinished
Constructors
ActionWorker(WorkerParent, String, Action<ActionWorker>)
Initializes a new instance of the ActionWorker worker that will execute a synchronous action.
Declaration
public ActionWorker(WorkerParent workerParent, string workerName, Action<ActionWorker> action)
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 |
| Action<ActionWorker> | action | The synchronous action to execute, optionally creating child workers. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
ActionWorker(WorkerParent, String, Func<ActionWorker, OutcomeStatus>)
Initializes a new instance of the ActionWorker worker that will execute a synchronous function.
Declaration
public ActionWorker(WorkerParent workerParent, string workerName, Func<ActionWorker, OutcomeStatus> func)
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<ActionWorker, OutcomeStatus> | func | The synchronous function to execute, optionally creating child workers. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
ActionWorker(WorkerParent, String, Func<ActionWorker, Task<OutcomeStatus>>)
Initializes a new instance of the ActionWorker worker that will execute an asynchronous function.
Declaration
public ActionWorker(WorkerParent workerParent, string workerName, Func<ActionWorker, Task<OutcomeStatus>> funcAsync)
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<ActionWorker, Task<OutcomeStatus>> | funcAsync | The asynchronous function to execute, optionally creating child workers. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
ActionWorker(WorkerParent, String, Func<ActionWorker, Task>)
Initializes a new instance of the ActionWorker worker that will execute an asynchronous action.
Declaration
public ActionWorker(WorkerParent workerParent, string workerName, Func<ActionWorker, Task> actionAsync)
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<ActionWorker, Task> | actionAsync | The asynchronous action to execute, optionally creating child workers. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
ActionWorker(WorkerParent, String, Func<Boolean>, Action<ActionWorker>)
Initializes a new instance of the ActionWorker worker that will execute a synchronous action.
Declaration
public ActionWorker(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Action<ActionWorker> action)
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 |
| Action<ActionWorker> | action | The synchronous action to execute, optionally creating child workers. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
ActionWorker(WorkerParent, String, Func<Boolean>, Func<ActionWorker, OutcomeStatus>)
Initializes a new instance of the ActionWorker worker that will execute a synchronous function.
Declaration
public ActionWorker(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Func<ActionWorker, OutcomeStatus> func)
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<ActionWorker, OutcomeStatus> | func | The synchronous function to execute, optionally creating child workers. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
ActionWorker(WorkerParent, String, Func<Boolean>, Func<ActionWorker, Task<OutcomeStatus>>)
Initializes a new instance of the ActionWorker worker that will execute an asynchronous function.
Declaration
public ActionWorker(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Func<ActionWorker, Task<OutcomeStatus>> funcAsync)
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 worker start constraints. Defaults to true if not supplied or null. |
| Func<ActionWorker, Task<OutcomeStatus>> | funcAsync | The asynchronous function to execute, optionally creating child workers. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
ActionWorker(WorkerParent, String, Func<Boolean>, Func<ActionWorker, Task>)
Initializes a new instance of the ActionWorker worker that will execute an asynchronous action.
Declaration
public ActionWorker(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, Func<ActionWorker, Task> actionAsync)
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<ActionWorker, Task> | actionAsync | The asynchronous action to execute, optionally creating child workers. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|