Class SharedKillSwitch
A SharedKillSwitch is a provider for IGraph<TShape>s of FlowShape<TIn, TOut> that can be completed or failed from the outside.
A IGraph<TShape> returned by the switch can be materialized arbitrary amount of times: every newly materializedIGraph<TShape> belongs to the switch from which it was acquired. Multiple SharedKillSwitch instances are isolated from each other, shutting down or aborting on instance does not affect the IGraph<TShape>s provided by another instance.
After calling Shutdown() all materialized, running instances of all IGraph<TShape>s provided by the SharedKillSwitch will complete their downstreams and cancel their upstreams(unless if finished or failed already in which case the command is ignored). Subsequent invocations of Shutdown() and Abort(Exception) will be ignored.
After calling Abort(Exception) all materialized, running instances of all IGraph<TShape>s provided by the SharedKillSwitch will fail their downstreams with the provided exception and cancel their upstreams (unless it finished or failed already in which case the command is ignored). Subsequent invocations of Shutdown() and Abort(Exception) will be ignored.
The IGraph<TShape>s provided by the SharedKillSwitch do not modify the passed through elements in any way or affect backpressure in the stream. All provided IGraph<TShape>s provide the parent SharedKillSwitch as materialized value.
This class is thread-safe, the instance can be passed safely among threads and its methods may be invoked concurrently.
Implements
Inherited Members
Namespace: Akka.Streams
Assembly: Akka.Streams.dll
Syntax
public sealed class SharedKillSwitch : IKillSwitch
Methods
| Improve this Doc View SourceAbort(Exception)
After calling Abort(Exception) all materialized, running instances of all IGraph<TShape>s provided by the SharedKillSwitch will fail their downstreams with the provided exception and cancel their upstreams (unless it finished or failed already in which case the command is ignored). Subsequent invocations of Shutdown() and Abort(Exception) will be ignored.
These provided IGraph<TShape>s materialize to their owning switch. This might make certain integrations simpler than passing around the switch instance itself.
Declaration
public void Abort(Exception cause)
Parameters
Type | Name | Description |
---|---|---|
Exception | cause | The exception to be used for failing the linked IGraph<TShape>s |
Flow<T>()
Returns a typed Flow of a requested type that will be linked to this SharedKillSwitch instance. By invoking Shutdown() or Abort(Exception) all running instances of all provided IGraph<TShape>s by this switch will be stopped normally or failed.
Declaration
public IGraph<FlowShape<T, T>, SharedKillSwitch> Flow<T>()
Returns
Type | Description |
---|---|
IGraph<FlowShape<T, T>, SharedKillSwitch> | A reusable IGraph<TShape> that is linked with the switch. The materialized value provided is this switch itself. |
Type Parameters
Name | Description |
---|---|
T | Type of the elements the Flow will forward |
Shutdown()
After calling Shutdown() all materialized, running instances of all IGraph<TShape>s provided by the SharedKillSwitch will complete their downstreams and cancel their upstreams (unless if finished or failed already in which case the command is ignored). Subsequent invocations of Shutdown() and Abort(Exception) will be ignored.
Declaration
public void Shutdown()
ToString()
TBD
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | TBD |