Search Results for

    Show / Hide Table of Contents

    Class KillSwitches

    Creates shared or single kill switches which can be used to control completion of graphs from the outside.

    • The factory Shared(string) returns a SharedKillSwitch which provides a IGraph<TShape> of FlowShape<TIn, TOut> that can be used in arbitrary number of graphs and materializations. The switch simultaneously controls completion in all of those graphs.
    • The factory Single<T>() returns a IGraph<TShape> of FlowShape<TIn, TOut> that materializes to a UniqueKillSwitch which is always unique to that materialized Flow itself.
    Inheritance
    object
    KillSwitches
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Streams
    Assembly: Akka.Streams.dll
    Syntax
    public static class KillSwitches

    Methods

    | Edit this page View Source

    AsFlow<T>(CancellationToken, bool)

    Returns a flow, which works like a kill switch stage based on a provided cancellationToken. Since unlike cancellation tokens, kill switches expose ability to finish a stream either gracefully via Shutdown() or abruptly via Abort(Exception), this distinction is handled by specifying cancelGracefully parameter.

    Declaration
    public static IGraph<FlowShape<T, T>, NotUsed> AsFlow<T>(this CancellationToken cancellationToken, bool cancelGracefully = false)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    Cancellation token used to create a cancellation flow.

    bool cancelGracefully

    When set to true, will close stream gracefully via completting the stage. When set to false, will close stream by failing the stage with OperationCanceledException.

    Returns
    Type Description
    IGraph<FlowShape<T, T>, NotUsed>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    Shared(string)

    Creates a new SharedKillSwitch with the given name that can be used to control the completion of multiple streams from the outside simultaneously.

    Declaration
    public static SharedKillSwitch Shared(string name)
    Parameters
    Type Name Description
    string name

    TBD

    Returns
    Type Description
    SharedKillSwitch

    TBD

    | Edit this page View Source

    SingleBidi<T1, T2>()

    Creates a new IGraph<TShape> of BidiShape<TIn1, TOut1, TIn2, TOut2> that materializes to an external switch that allows external completion of that unique materialization. Different materializations result in different, independent switches.

    For a Flow version see Single<T>()

    Declaration
    public static IGraph<BidiShape<T1, T1, T2, T2>, UniqueKillSwitch> SingleBidi<T1, T2>()
    Returns
    Type Description
    IGraph<BidiShape<T1, T1, T2, T2>, UniqueKillSwitch>

    TBD

    Type Parameters
    Name Description
    T1

    TBD

    T2

    TBD

    | Edit this page View Source

    Single<T>()

    Creates a new IGraph<TShape> of FlowShape<TIn, TOut> that materializes to an external switch that allows external completion of that unique materialization. Different materializations result in different, independent switches.

    For a Bidi version see SingleBidi<T1, T2>()

    Declaration
    public static IGraph<FlowShape<T, T>, UniqueKillSwitch> Single<T>()
    Returns
    Type Description
    IGraph<FlowShape<T, T>, UniqueKillSwitch>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET