Search Results for

    Show / Hide Table of Contents

    Class WorkerSystem

    A class that creates and runs a system of workers. Typical use involves adding user logic with a Root(Action<WorkerSystem>) overload, and start the worker system with StartAsync() or Start().

    To create a custom reusable worker system type, either inherit from this class (if retaining the Root(Action<WorkerSystem>) overloads), or from WorkerSystemBase<TDerived>.

    Inheritance
    Object
    WorkerParent
    WorkerSystemBase
    WorkerSystemBase<WorkerSystem>
    WorkerSystem
    Implements
    IDisposeOnFinished
    Inherited Members
    WorkerSystemBase<WorkerSystem>.AddCompletedCallback(Func<WorkerSystem, OutcomeStatus, Task<OutcomeStatus>>)
    WorkerSystemBase<WorkerSystem>.AddStartingCallback(Func<WorkerSystem, Task<ProgressStatus>>)
    WorkerSystemBase<WorkerSystem>.SetValue(String, String, String)
    WorkerSystemBase<WorkerSystem>.SetValue(String, String)
    WorkerSystemBase<WorkerSystem>.SetValue(String, String, Int64)
    WorkerSystemBase<WorkerSystem>.SetValue(String, Int64)
    WorkerSystemBase.AddCompletedCallback(Func<WorkerSystemBase, OutcomeStatus, Task<OutcomeStatus>>)
    WorkerSystemBase.AddStartingCallback(Func<WorkerSystemBase, Task<ProgressStatus>>)
    WorkerSystemBase.Config
    WorkerSystemBase.CreationGuid
    WorkerSystemBase.IsCancelRequested
    WorkerSystemBase.Start()
    WorkerSystemBase.StartAsync()
    WorkerSystemBase.TryCancel(String)
    WorkerSystemBase.LicenseMaxWorkerTypes
    WorkerParent.AddChildCompletedCallback(Action<WorkerBase>)
    WorkerParent.AddStartingChildrenCallback(Func<WorkerParent, Task<ProgressStatus>>)
    WorkerParent.BytesPerRowBuffer
    WorkerParent.Children
    WorkerParent.DisposeOnFinished<TDisposable>(TDisposable)
    WorkerParent.GetDownstreamFactory<TInput>()
    WorkerParent.HasChildren
    WorkerParent.IsCanceled
    WorkerParent.IsCompleted
    WorkerParent.IsCreated
    WorkerParent.IsError
    WorkerParent.IsFailed
    WorkerParent.IsFatal
    WorkerParent.IsRunning
    WorkerParent.IsSucceeded
    WorkerParent.KeepChildrenLevels
    WorkerParent.Locator
    WorkerParent.LogFactory
    WorkerParent.Logger
    WorkerParent.MaxRunningChildren
    WorkerParent.Name
    WorkerParent.RemoveChildren()
    WorkerParent.RescheduleChildren()
    WorkerParent.RunChildrenAsync(Boolean)
    WorkerParent.RunChildrenAsync()
    WorkerParent.Status
    WorkerParent.Item[String]
    WorkerParent.ToString()
    WorkerParent.WorkerSystem
    WorkerParent.DebugCommands
    WorkerParent.AggregateErrorOutputRows
    WorkerParent.AggregateOutputRows
    WorkerParent.AggregateWorkersCompleted
    WorkerParent.InstantCompleted
    WorkerParent.InstantCreated
    WorkerParent.InstantStarted
    WorkerParent.RunningDuration
    Namespace: actionETL
    Assembly: actionETL.dll
    Syntax
    public class WorkerSystem : WorkerSystemBase<WorkerSystem>, IDisposeOnFinished

    Constructors

    WorkerSystem()

    Initializes a new instance of WorkerSystem, which is used to create and run a system of workers. It will get the name "Root", and will look for the configuration settings file and the logging configuration file in the default locations.

    Declaration
    public WorkerSystem()
    Exceptions
    Type Condition
    Exception

    (Various Newtonsoft.Json.JsonException license and configuration reading and parsing exceptions).

    FormatException

    File parse error.

    IOException

    An I/O error occurred.

    InvalidOperationException
    • actionETL requires '.NET framework version 4.6.2' or later (available from Microsoft), please install this or a later version.
    • No license text found in file.
    • No valid license found.

    WorkerSystem(IConfigurationService)

    Initializes a new instance of WorkerSystem, which is used to create and run a system of workers. It will get the default name "Root", and look for the logging configuration file in the default locations.

    Declaration
    public WorkerSystem(IConfigurationService configurationService)
    Parameters
    Type Name Description
    IConfigurationService configurationService

    The configuration service. If null, will look for the configuration file in the default locations.

    Exceptions
    Type Condition
    Exception

    (Various Newtonsoft.Json.JsonException license and configuration reading and parsing exceptions).

    FormatException

    File parse error.

    IOException

    An I/O error occurred.

    InvalidOperationException
    • actionETL requires '.NET framework version 4.6.2' or later (available from Microsoft), please install this or a later version.
    • No license text found in file.
    • No valid license found.

    WorkerSystem(IALogFactory)

    Initializes a new instance of WorkerSystem, which is used to create and run a system of workers. It will get the default name "Root", and look for the configuration settings file in the default locations.

    Declaration
    public WorkerSystem(IALogFactory logFactory)
    Parameters
    Type Name Description
    IALogFactory logFactory

    The log factory. If null, will look for the logging configuration file in the default locations.

    Exceptions
    Type Condition
    Exception

    (Various Newtonsoft.Json.JsonException license and configuration reading and parsing exceptions).

    FormatException

    File parse error.

    IOException

    An I/O error occurred.

    InvalidOperationException
    • actionETL requires '.NET framework version 4.6.2' or later (available from Microsoft), please install this or a later version.
    • No license text found in file.
    • No valid license found.

    WorkerSystem(String)

    Initializes a new instance of WorkerSystem, which is used to create and run a system of workers. It will look for the configuration settings file and the logging configuration file in the default locations.

    Declaration
    public WorkerSystem(string workerSystemName)
    Parameters
    Type Name Description
    String workerSystemName

    Name of the worker system, which will be the first level of the Locator string.

    Defaults to "Root" if set to null or whitespace.

    Cannot contain "/", or start with double underscore "__".

    Exceptions
    Type Condition
    Exception

    (Various Newtonsoft.Json.JsonException license and configuration reading and parsing exceptions).

    FormatException

    File parse error.

    IOException

    An I/O error occurred.

    InvalidOperationException
    • actionETL requires '.NET framework version 4.6.2' or later (available from Microsoft), please install this or a later version.
    • No license text found in file.
    • No valid license found.

    WorkerSystem(String, IConfigurationService)

    Initializes a new instance of WorkerSystem, which is used to create and run a system of workers. It will look for the logging configuration file in the default locations.

    Declaration
    public WorkerSystem(string workerSystemName, IConfigurationService configurationService)
    Parameters
    Type Name Description
    String workerSystemName

    Name of the worker system, which will be the first level of the Locator string.

    Defaults to "Root" if set to null or whitespace.

    Cannot contain "/", or start with double underscore "__".

    IConfigurationService configurationService

    The configuration service. If null, will look for the configuration file in the default locations.

    Exceptions
    Type Condition
    Exception

    (Various Newtonsoft.Json.JsonException license and configuration reading and parsing exceptions).

    FormatException

    File parse error.

    IOException

    An I/O error occurred.

    InvalidOperationException
    • actionETL requires '.NET framework version 4.6.2' or later (available from Microsoft), please install this or a later version.
    • No license text found in file.
    • No valid license found.

    WorkerSystem(String, IConfigurationService, IALogFactory)

    Initializes a new instance of WorkerSystem, which is used to create and run a system of workers.

    Declaration
    public WorkerSystem(string workerSystemName, IConfigurationService configurationService, IALogFactory logFactory)
    Parameters
    Type Name Description
    String workerSystemName

    Name of the worker system, which will be the first level of the Locator string.

    Defaults to "Root" if set to null or whitespace.

    Cannot contain "/", or start with double underscore "__".

    IConfigurationService configurationService

    The configuration service. If null, will look for the configuration file in the default locations.

    IALogFactory logFactory

    The log factory. If null, will look for the logging configuration file in the default locations.

    Exceptions
    Type Condition
    Exception

    (Various Newtonsoft.Json.JsonException license and configuration reading and parsing exceptions).

    FormatException

    File parse error.

    IOException

    An I/O error occurred.

    InvalidOperationException
    • actionETL requires '.NET framework version 4.6.2' or later (available from Microsoft), please install this or a later version.
    • No license text found in file.
    • No valid license found.

    WorkerSystem(String, IALogFactory)

    Initializes a new instance of WorkerSystem, which is used to create and run a system of workers. It will look for the configuration settings file in the default locations.

    Declaration
    public WorkerSystem(string workerSystemName, IALogFactory logFactory)
    Parameters
    Type Name Description
    String workerSystemName

    Name of the worker system, which will be the first level of the Locator string.

    Defaults to "Root" if set to null or whitespace.

    Cannot contain "/", or start with double underscore "__".

    IALogFactory logFactory

    The log factory. If null, will look for the logging configuration file in the default locations.

    Exceptions
    Type Condition
    Exception

    (Various Newtonsoft.Json.JsonException license and configuration reading and parsing exceptions).

    FormatException

    File parse error.

    IOException

    An I/O error occurred.

    InvalidOperationException
    • actionETL requires '.NET framework version 4.6.2' or later (available from Microsoft), please install this or a later version.
    • No license text found in file.
    • No valid license found.

    Methods

    Root(Action<WorkerSystem>)

    Specifies the synchronous action to run (which usually entails creating workers) when the worker system is started. Using Root means that the workers are only created (usually by their direct parent) if and when needed, as specified by workers and their constraints.

    Note that it is also possible to create and add workers to the worker system before the worker system has started, see the conceptual documentation for details.

    Note: This method is thread-safe.

    Declaration
    public WorkerSystem Root(Action<WorkerSystem> action)
    Parameters
    Type Name Description
    Action<WorkerSystem> action

    The callback to run. It receives the worker system as a parameter, which should be passed to any workers created directly under the root. If the action does not throw, the callback is assumed to have succeeded.

    Returns
    Type Description
    WorkerSystem

    The worker system, which e.g. can be used to call StartAsync().

    Exceptions
    Type Condition
    InvalidOperationException

    Root() can only be called once.

    Root(Func<WorkerSystem, OutcomeStatus>)

    Specifies the synchronous function to run (which usually entails creating workers) when the worker system is started. Using Root means that the workers are only created (usually by their direct parent) if and when needed, as specified by workers and their constraints.

    Note that it is also possible to create and add workers to the worker system before the worker system has started, see the conceptual documentation for details.

    Note: This method is thread-safe.

    Declaration
    public WorkerSystem Root(Func<WorkerSystem, OutcomeStatus> func)
    Parameters
    Type Name Description
    Func<WorkerSystem, OutcomeStatus> func

    The callback to run. It receives the worker system as a parameter, which should be passed to any workers created directly under the root. Must return an OutcomeStatus that describes success or failure of the callback.

    Returns
    Type Description
    WorkerSystem

    The worker system, which e.g. can be used to call StartAsync().

    Exceptions
    Type Condition
    InvalidOperationException

    Root() can only be called once.

    Root(Func<WorkerSystem, Task<OutcomeStatus>>)

    Specifies the asynchronous function to run (which usually entails creating workers) when the worker system is started. Using Root means that the workers are only created (usually by their direct parent) if and when needed, as specified by workers and their constraints.

    Note that it is also possible to create and add workers to the worker system before the worker system has started, see the conceptual documentation for details.

    Note: This method is thread-safe.

    Declaration
    public WorkerSystem Root(Func<WorkerSystem, Task<OutcomeStatus>> funcAsync)
    Parameters
    Type Name Description
    Func<WorkerSystem, Task<OutcomeStatus>> funcAsync

    The callback to run. It receives the worker system as a parameter, which should be passed to any workers created directly under the root. Must return an OutcomeStatus that describes success or failure of the callback.

    Returns
    Type Description
    WorkerSystem

    The worker system, which e.g. can be used to call StartAsync().

    Exceptions
    Type Condition
    InvalidOperationException

    Root() can only be called once.

    Root(Func<WorkerSystem, Task>)

    Specifies the asynchronous action to run (which usually entails creating workers) when the worker system is started. Using Root means that the workers are only created (usually by their direct parent) if and when needed, as specified by workers and their constraints.

    Note that it is also possible to create and add workers to the worker system before the worker system has started, see the conceptual documentation for details.

    Note: This method is thread-safe.

    Declaration
    public WorkerSystem Root(Func<WorkerSystem, Task> actionAsync)
    Parameters
    Type Name Description
    Func<WorkerSystem, Task> actionAsync

    The callback to run. It receives the worker system as a parameter, which should be passed to any workers created directly under the root. If the action does not throw, the callback is assumed to have succeeded.

    Returns
    Type Description
    WorkerSystem

    The worker system, which e.g. can be used to call StartAsync().

    Exceptions
    Type Condition
    InvalidOperationException

    Root() can only be called once.

    RunAsync()

    The worker system calls this method during its Running phase. Override it to implement any worker system specific logic. This class uses it to implement the functionality of the Root(Action<WorkerSystem>) overloads.

    If this method returns a Succeeded status and did not call an RunChildrenAsync() overload, then the system will run the workers.

    Note that the worker system Running phase also includes additional places where logic can optionally be inserted via callbacks, to e.g. customize the initialization, cleanup, and error handling.

    Declaration
    protected override Task<OutcomeStatus> RunAsync()
    Returns
    Type Description
    Task<OutcomeStatus>

    An OutcomeStatus describing the success or failure of the worker system.

    Overrides
    WorkerParent.RunAsync()

    Implements

    IDisposeOnFinished
    In This Article
    Back to top Copyright © 2023 Envobi Ltd