Search Results for

    Show / Hide Table of Contents

    Class SplitTransformFactory

    Factory methods that create a SplitTransform<TInputOutputError> dataflow worker, with one input, one or more outputs, and one error output port, all of the same type, that sends each incoming row to one of several output ports, or to the error output port, or discards the row, based on a supplied function.

    Note that output ports can be added after the worker is created (but before it or its siblings have started) by repeatedly calling Create<TOutput>(String). This can be particularly useful when generating the downstream workers in a loop.

    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>).

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

    Methods

    SplitTransform<TInputOutputError>(in DownstreamFactory<TInputOutputError>, String, Func<TInputOutputError, Int32>, Int32)

    Initializes a new instance of the SplitTransform<TInputOutputError> dataflow worker, with one input, one or more outputs, and one error output port, all of the same type, that sends each incoming row to one of several output ports, or to the error output port, or discards the row, based on a supplied function.

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

    Declaration
    public static SplitTransform<TInputOutputError> SplitTransform<TInputOutputError>(this in DownstreamFactory<TInputOutputError> downstreamFactory, string workerName, Func<TInputOutputError, int> splitFunc, int numberOfOutputs)
        where TInputOutputError : class
    Parameters
    Type Name Description
    DownstreamFactory<TInputOutputError> 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<TInputOutputError, Int32> splitFunc

    A function that returns the output port number (from 0 to numberOfOutputs - 1) to send the row to, or -1 to send the row to the error output port, or -2 to discard the row.

    Consider creating an enum for all possible values, i.e. one value for each output port, plus Reject (-1) and Discard (-2).

    Int32 numberOfOutputs

    The number of output ports.

    Returns
    Type Description
    SplitTransform<TInputOutputError>

    The newly created and (optionally) linked worker.

    Type Parameters
    Name Description
    TInputOutputError

    The type of each Input and outgoing 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?

    SplitTransform<TInputOutputError>(in DownstreamFactory<TInputOutputError>, String, Func<TInputOutputError, Int32>, String[])

    Initializes a new instance of the SplitTransform<TInputOutputError> dataflow worker, with one input, one or more outputs, and one error output port, all of the same type, that sends each incoming row to one of several output ports, or to the error output port, or discards the row, based on a supplied function.

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

    Declaration
    public static SplitTransform<TInputOutputError> SplitTransform<TInputOutputError>(this in DownstreamFactory<TInputOutputError> downstreamFactory, string workerName, Func<TInputOutputError, int> splitFunc, params string[] outputNames)
        where TInputOutputError : class
    Parameters
    Type Name Description
    DownstreamFactory<TInputOutputError> 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<TInputOutputError, Int32> splitFunc

    A function that returns the output port number (from 0 to numberOfOutputs - 1) to send the row to, or -1 to send the row to the error output port, or -2 to discard the row.

    Consider creating an enum for all possible values, i.e. one value for each output port, plus Reject (-1) and Discard (-2).

    String[] outputNames

    The output port names.

    Returns
    Type Description
    SplitTransform<TInputOutputError>

    The newly created and (optionally) linked worker.

    Type Parameters
    Name Description
    TInputOutputError

    The type of each Input and outgoing 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 '__'.
    ArgumentException

    outputNames: Must specify at least one output port name. Use a different overload to specify 0 output ports.

    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

    SplitTransform<TInputOutputError>
    In This Article
    Back to top Copyright © 2023 Envobi Ltd