Search Results for

    Show / Hide Table of Contents

    Class ActionTargetFactory

    Factory methods that create an ActionTarget<TInput> or ActionTarget<TInput, TError> dataflow worker, which runs an asynchronous callback once, which in turn calls methods on the Input port to consume rows from the upstream worker.

    The Input port is linked to (if available) the upstream output or error output port specified by the factory.

    Get the factory 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>).

    Also see the ActionTarget example.

    Note: This class only has overloads for asynchronous callbacks, since using synchronous ones would require the callback to block a thread when there are no upstream rows available, which is not appropriate.

    Inheritance
    Object
    ActionTargetFactory
    Namespace: actionETL
    Assembly: actionETL.dll
    Syntax
    public static class ActionTargetFactory

    Methods

    ActionTarget<TInput>(in DownstreamFactory<TInput>, String, Func<ActionTarget<TInput>, Task<OutcomeStatus>>)

    Initializes a new instance of the ActionTarget<TInput> dataflow worker, which executes an asynchronous callback once, which in turn calls methods on the Input port to consume rows from the upstream worker.

    The Input port is linked to (if available) the upstream output or error output port specified by the factory.

    The target does not have any ErrorOutput port.

    Also see the ActionTarget example.

    Note: The input port uses the Default policy. Consider whether this is appropriate, or should be changed, see BufferingMode for further details.

    Declaration
    public static ActionTarget<TInput> ActionTarget<TInput>(this in DownstreamFactory<TInput> downstreamFactory, string workerName, Func<ActionTarget<TInput>, Task<OutcomeStatus>> funcAsync)
        where TInput : class
    Parameters
    Type Name Description
    DownstreamFactory<TInput> 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 "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Func<ActionTarget<TInput>, Task<OutcomeStatus>> funcAsync

    The asynchronous function to execute. Return an failure OutcomeStatus to fail the worker.

    Returns
    Type Description
    ActionTarget<TInput>

    The newly created and (optionally) linked worker.

    Type Parameters
    Name Description
    TInput

    The type of each Input row.

    Exceptions
    Type Condition
    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    ArgumentNullException

    workerParent - All workers must have a parent. The top level workers have the worker system as parent.

    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    ActionTarget<TInput>(in DownstreamFactory<TInput>, String, Func<ActionTarget<TInput>, Task>)

    Initializes a new instance of the ActionTarget<TInput> dataflow worker, which executes an asynchronous callback once, which in turn calls methods on the Input port to consume rows from the upstream worker.

    The Input port is linked to (if available) the upstream output or error output port specified by the factory.

    The target does not have any ErrorOutput port.

    Also see the ActionTarget example.

    Note: The input port uses the Default policy. Consider whether this is appropriate, or should be changed, see BufferingMode for further details.

    Declaration
    public static ActionTarget<TInput> ActionTarget<TInput>(this in DownstreamFactory<TInput> downstreamFactory, string workerName, Func<ActionTarget<TInput>, Task> actionAsync)
        where TInput : class
    Parameters
    Type Name Description
    DownstreamFactory<TInput> 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 "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Func<ActionTarget<TInput>, Task> actionAsync

    The asynchronous action to execute.

    Returns
    Type Description
    ActionTarget<TInput>

    The newly created and (optionally) linked worker.

    Type Parameters
    Name Description
    TInput

    The type of each Input row.

    Exceptions
    Type Condition
    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    ArgumentNullException

    workerParent - All workers must have a parent. The top level workers have the worker system as parent.

    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    ActionTarget<TInput, TError>(in DownstreamFactory<TInput>, String, Func<ActionTarget<TInput, TError>, Task<OutcomeStatus>>)

    Initializes a new instance of the ActionTarget<TInput, TError> dataflow worker, which executes an asynchronous callback once, which in turn calls methods on the Input port to consume rows from the upstream worker.

    The Input port is linked to (if available) the upstream output or error output port specified by the factory.

    Note that the target has an ErrorOutput port, and the port type parameters must be specified, e.g.:

    .Output.Link.ActionTarget<SmallClass,SmallClass>(
        "target"
        , async rat =>
        {
            // Consume input, and optionally send to the ErrorOutput port
        }
        );

    Also see the ActionTarget example.

    Note: The input port uses the Default policy. Consider whether this is appropriate, or should be changed, see BufferingMode for further details.

    Declaration
    public static ActionTarget<TInput, TError> ActionTarget<TInput, TError>(this in DownstreamFactory<TInput> downstreamFactory, string workerName, Func<ActionTarget<TInput, TError>, Task<OutcomeStatus>> funcAsync)
        where TInput : class where TError : class
    Parameters
    Type Name Description
    DownstreamFactory<TInput> 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 "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Func<ActionTarget<TInput, TError>, Task<OutcomeStatus>> funcAsync

    The asynchronous function to execute. Return an failure OutcomeStatus to fail the worker.

    Returns
    Type Description
    ActionTarget<TInput, TError>

    The newly created and (optionally) linked worker.

    Type Parameters
    Name Description
    TInput

    The type of each Input row.

    TError

    The type of each ErrorOutput row.

    Exceptions
    Type Condition
    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    ArgumentNullException

    workerParent - All workers must have a parent. The top level workers have the worker system as parent.

    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    ActionTarget<TInput, TError>(in DownstreamFactory<TInput>, String, Func<ActionTarget<TInput, TError>, Task>)

    Initializes a new instance of the ActionTarget<TInput, TError> dataflow worker, which executes an asynchronous callback once, which in turn calls methods on the Input port to consume rows from the upstream worker.

    The Input port is linked to (if available) the upstream output or error output port specified by the factory.

    Note that the target has an ErrorOutput port, and the port type parameters must be specified, e.g.:

    .Output.Link.ActionTarget<SmallClass,SmallClass>(
        "target"
        , async rat =>
        {
            // Consume input, and optionally send to the ErrorOutput port
        }
        );

    Also see the ActionTarget example.

    Note: The input port uses the Default policy. Consider whether this is appropriate, or should be changed, see BufferingMode for further details.

    Declaration
    public static ActionTarget<TInput, TError> ActionTarget<TInput, TError>(this in DownstreamFactory<TInput> downstreamFactory, string workerName, Func<ActionTarget<TInput, TError>, Task> actionAsync)
        where TInput : class where TError : class
    Parameters
    Type Name Description
    DownstreamFactory<TInput> 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 "/" (e.g. "MyPrefix-/") to generate a unique name from the prefix plus an increasing number starting at 1.

    While less useful, set to null, whitespace or "/" to generate a unique name from the worker type plus an increasing number starting at 1.

    The name cannot otherwise contain "/", and cannot start with double underscore "__".

    Func<ActionTarget<TInput, TError>, Task> actionAsync

    The asynchronous action to execute.

    Returns
    Type Description
    ActionTarget<TInput, TError>

    The newly created and (optionally) linked worker.

    Type Parameters
    Name Description
    TInput

    The type of each Input row.

    TError

    The type of each ErrorOutput row.

    Exceptions
    Type Condition
    ArgumentException

    workerName:

    • Workers with the same parent must have unique names.
    • Worker and worker system names cannot contain '/' or start with double underscore '__'.
    ArgumentNullException

    workerParent - All workers must have a parent. The top level workers have the worker system as parent.

    InvalidOperationException
    • Cannot add child worker to parent which has completed. Are you adding it to the correct parent?
    • Cannot add worker to parent, since its children have been started. Are you adding it to the correct parent?

    See Also

    ActionTarget<TInput>
    ActionTarget<TInput, TError>
    In This Article
    Back to top Copyright © 2023 Envobi Ltd