Search Results for

    Show / Hide Table of Contents

    Class InputPortCollection

    A collection of all input ports for a worker, always available as Inputs.

    This class is used when you either don't need to know the row type of each port, or you cast the port(s) to have the actual row type (using an explicit cast or ToArray<TInput>()).

    Note that workers with ports typically add additional members that allow access to typed versions of the ports, and workers with an unknown number of input ports of the same type typically adds an InputPortCollection<TInput>.

    Inheritance
    Object
    InputPortCollection
    Implements
    IReadOnlyList<InputPort>
    IReadOnlyCollection<InputPort>
    IEnumerable<InputPort>
    IEnumerable
    Namespace: actionETL
    Assembly: actionETL.dll
    Syntax
    public class InputPortCollection : IReadOnlyList<InputPort>, IReadOnlyCollection<InputPort>, IEnumerable<InputPort>, IEnumerable

    Properties

    AnyActivated

    Returns true if any input port has an InputPortState higher than Ready; otherwise, false. This is used by DefaultIsStartable(), and can also be used in your own custom start conditions.

    Note: This property is thread-safe.

    Declaration
    public bool AnyActivated { get; }
    Property Value
    Type Description
    Boolean

    AreAllCompleted

    Returns true if all ports are completed, or there are no ports; otherwise false.

    Note that this check is not atomic, i.e. it is possible for this property to return false, even though the final port completed before this property returns its value. It is therefore in most scenarios required to periodically recheck it until it returns true.

    Note: This property is thread-safe.

    Declaration
    public bool AreAllCompleted { get; }
    Property Value
    Type Description
    Boolean

    Count

    Gets the number of input ports in the collection.

    Note: This property is thread-safe.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    Int32

    FailedCount

    Returns the number of unsuccessful (Error or Fatal) input ports.

    Note that this calculation is not atomic, i.e. it is possible for additional ports to fail while this property is calculated, without being included in the returned value. It is therefore in most scenarios required to periodically recheck it until it reaches any desired threshold.

    Declaration
    public int FailedCount { get; }
    Property Value
    Type Description
    Int32

    Item[Int32]

    Returns the InputPort at the specified index. Note that the 'untyped' InputPort base class is returned, which does not specify the type of the input rows. If the row type is needed, either cast the returned value to the row type, or use worker specific members that provide the row type.

    Note: This indexer is thread-safe.

    Declaration
    public InputPort this[int index] { get; }
    Parameters
    Type Name Description
    Int32 index

    The input port index. This corresponds to the order in which the ports were added, starting with 0.

    Property Value
    Type Description
    InputPort
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    index

    Item[String]

    Returns the InputPort with the specified port name. Note that the 'untyped' InputPort base class is returned, which does not specify the type of the input rows. If the row type is needed, either cast the returned value to the row type, or use worker specific members that provide the row type.

    Note: This indexer is thread-safe.

    Declaration
    public InputPort this[string inputPortName] { get; }
    Parameters
    Type Name Description
    String inputPortName

    Name of the input port.

    Property Value
    Type Description
    InputPort
    Exceptions
    Type Condition
    ArgumentException

    Input inputPortName not found.

    Worker

    Gets the worker these input ports belong to.

    Note: Retrieving this property is thread-safe, but only some of the WorkerBase members are thread-safe.

    Declaration
    public WorkerBase Worker { get; }
    Property Value
    Type Description
    WorkerBase

    Methods

    Create<TInput>(String, OutputPortBase<TInput>)

    Creates and adds an input port to the collection.

    Note: This method is thread-safe.

    Declaration
    public InputPort<TInput> Create<TInput>(string inputPortName, OutputPortBase<TInput> inputFrom)
        where TInput : class
    Parameters
    Type Name Description
    String inputPortName

    Name of the input port. Must be unique among the input ports on this worker.

    OutputPortBase<TInput> inputFrom

    The upstream output (or error output) port to link this input port from. Can be null, in which case the port must be linked before this worker or its siblings run.

    Returns
    Type Description
    InputPort<TInput>

    The created input port, which is often used to assign a typed input port property, e.g. with the default name Input.

    Type Parameters
    Name Description
    TInput

    The row type.

    Exceptions
    Type Condition
    ArgumentException
    • inputPortName cannot be null or only whitespace.
    • Input port name already exists.
    InvalidOperationException

    Cannot add port after the worker parent has started running its children.

    GetEnumerator()

    Returns an enumerator that iterates through the collection. To use it, all input ports must have the same row type.

    Note: This method is not thread-safe; use ToArray() or ToArray<TInput>() to get or iterate over the ports in a thread-safe manner.

    Declaration
    public IEnumerator<InputPort> GetEnumerator()
    Returns
    Type Description
    IEnumerator<InputPort>

    SkipAllRowsAsync()

    Discards incoming rows from all uncompleted input ports until they complete.

    Declaration
    public Task SkipAllRowsAsync()
    Returns
    Type Description
    Task

    A Task that completes when all input ports are completed.

    ToArray()

    Returns the input ports copied to a new array. The caller can manipulate the array without affecting the worker, e.g. reordering the array items.

    Note that the 'untyped' base class port is returned, which does not specify the type of the rows. If the row type is needed, instead use ToArray<TInput>().

    Note: This method is thread-safe.

    Declaration
    public InputPort[] ToArray()
    Returns
    Type Description
    InputPort[]

    ToArray<TInput>()

    Returns the input ports copied to a new array, with the ports cast to the generic input port type including row type. This is useful for workers where all input ports are of the same type.

    The caller can manipulate the array without affecting the worker, e.g. reordering the array items.

    Note: This method is thread-safe.

    Declaration
    public InputPort<TInput>[] ToArray<TInput>()
        where TInput : class
    Returns
    Type Description
    InputPort<TInput>[]
    Type Parameters
    Name Description
    TInput

    The row type.

    Exceptions
    Type Condition
    InvalidCastException

    An element in the sequence cannot be cast to the specified type.

    TryCancel()

    If any input ports are not already canceled or completed, cancels them, and requests cancellation of their upstream output (or error output) ports, which must stop sending data and clean up resources when they detect the cancellation. When the method returns, the input ports state is either canceled or completed.

    The caller should not take or skip any rows from any input port after this method returns. It is also not necessary to wait for canceled ports to complete before completing the worker (normally with a failure status), the system will do this automatically.

    Note that calling this method does not by itself cancel the worker system.

    Declaration
    public bool TryCancel()
    Returns
    Type Description
    Boolean

    true if any input port was not already canceled or completed; otherwise false. Note that in most scenarios the return value does not need to be checked.

    Exceptions
    Type Condition
    InvalidOperationException

    Port must be linked before canceling.

    Explicit Interface Implementations

    IEnumerable.GetEnumerator()

    Returns an enumerator that iterates through the collection. Use GetEnumerator() instead.

    Note: This method is not thread-safe; use ToArray() or ToArray<TInput>() to get or iterate over the ports in a thread-safe manner.

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    Implements

    System.Collections.Generic.IReadOnlyList<T>
    System.Collections.Generic.IReadOnlyCollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable

    See Also

    InputPort
    InputPort<TInput>
    IReadOnlyList<T>
    InputPortCollection<TInput>
    OutputPortCollection
    ErrorOutputPortCollection
    In This Article
    Back to top Copyright © 2023 Envobi Ltd