Click or drag to resize
Akka.NETDetachedStageTIn, TOut Class

Note: This API is now obsolete.

DetachedStage can be used to implement operations similar to BufferTIn, TOut, TMat(FlowTIn, TOut, TMat, Int32, OverflowStrategy), ExpandTIn, TOut1, TOut2, TMat(FlowTIn, TOut1, TMat, FuncTOut1, IEnumeratorTOut2) and ConflateTIn, TOut, TMat(FlowTIn, TOut, TMat, FuncTOut, TOut, TOut). DetachedStage implementations are boundaries between 1-bounded regions. This means that they need to enforce the "exactly one" property both on their upstream and downstream regions. As a consequence a DetachedStage can never answer an OnPull(IContext) with a Pull or answer an OnPush(TIn, IContext) with a Push(Object) since such an action would "steal" the event from one region (resulting in zero signals) and would inject it to the other region (resulting in two signals). However, DetachedStages have the ability to call HoldUpstream and HoldDownstream as a response to OnPush(TIn, IContext) and OnPull(IContext) which temporarily takes the signal off and stops execution, at the same time putting the stage in an IsHoldingBoth state. If the stage is in a holding state it contains one absorbed signal, therefore in this state the only possible command to call is PushAndPull(Object) which results in two events making the balance right again: 1 hold + 1 external event = 2 external event This mechanism allows synchronization between the upstream and downstream regions which otherwise can progress independently. @see PushPullStageTIn, TOut
Inheritance Hierarchy
SystemObject
  Akka.Streams.StageAbstractStageTIn, TOut
    Akka.Streams.StageAbstractStageTIn, TOut, IUpstreamDirective, IDownstreamDirective, IDetachedContextTOut
      Akka.Streams.StageDetachedStageTIn, TOut
        Akka.Streams.Implementation.FusingBufferT

Namespace:  Akka.Streams.Stage
Assembly:  Akka.Streams (in Akka.Streams.dll) Version: 1.2.3.42 (1.2.3.42)
Syntax
[ObsoleteAttribute("Please use GraphStage instead. [1.1.0]")]
public abstract class DetachedStage<TIn, TOut> : AbstractStage<TIn, TOut, IUpstreamDirective, IDownstreamDirective, IDetachedContext<TOut>>

Type Parameters

TIn
TBD
TOut
TBD

The DetachedStageTIn, TOut type exposes the following members.

Constructors
  NameDescription
Protected methodDetachedStageTIn, TOut
Initializes a new instance of the DetachedStageTIn, TOut class
Top
Properties
Methods
  NameDescription
Public methodDecide
If an exception is thrown from OnPush(TIn, IContext) this method is invoked to decide how to handle the exception. By default this method returns Stop.

If an exception is thrown from OnPull(IContext) the stream will always be completed with failure, because it is not always possible to recover from that state. In concrete stages it is of course possible to use ordinary try-catch-recover inside OnPull(IContext) when it is know how to recover from such exceptions.

(Inherited from AbstractStageTIn, TOut.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodOnDownstreamFinish(TContext)
This method is called when downstream has cancelled. By default the cancel signal is immediately propagated with Finish.
(Inherited from AbstractStageTIn, TOut, TPushDirective, TPullDirective, TContext.)
Public methodOnDownstreamFinish(IContext)
This method is called when downstream has cancelled. By default the cancel signal is immediately propagated with Finish.
(Inherited from AbstractStageTIn, TOut, TPushDirective, TPullDirective, TContext.)
Public methodOnPull(TContext)
This method is called when there is demand from downstream, i.e. you are allowed to push one element downstreams with Push(Object), or request elements from upstreams with Pull
(Inherited from AbstractStageTIn, TOut, TPushDirective, TPullDirective, TContext.)
Public methodOnPull(IContext)
This method is called when there is demand from downstream, i.e. you are allowed to push one element downstreams with Push(Object), or request elements from upstreams with Pull
(Inherited from AbstractStageTIn, TOut, TPushDirective, TPullDirective, TContext.)
Public methodOnPush(TIn, TContext)

This method is called when an element from upstream is available and there is demand from downstream, i.e. in OnPush(TIn, TContext) you are allowed to call Push(Object) to emit one element downstreams, or you can absorb the element by calling Pull. Note that you can only emit zero or one element downstream from OnPull(TContext).

To emit more than one element you have to push the remaining elements from OnPull(TContext), one-by-one. OnPush(TIn, TContext) is not called again until OnPull(TContext) has requested more elements with Pull.

(Inherited from AbstractStageTIn, TOut, TPushDirective, TPullDirective, TContext.)
Public methodOnUpstreamFailure(Exception, IContext)

OnUpstreamFailure(Exception, IContext) is called when upstream has signaled that the stream is completed with failure. It is not called if OnPull(TContext) or OnPush(TIn, TContext) of the stage itself throws an exception.

Note that elements that were emitted by upstream before the failure happened might not have been received by this stage when OnUpstreamFailure(Exception, IContext) is called, i.e. failures are not backpressured and might be propagated as soon as possible.

Here you cannot call Push(Object), because there might not be any demand from downstream. To emit additional elements before terminating you can use AbsorbTermination and push final elements from OnPull(TContext). The stage will then be in finishing state, which can be checked with IsFinishing.

(Inherited from AbstractStageTIn, TOut, TPushDirective, TPullDirective, TContext.)
Public methodOnUpstreamFailure(Exception, TContext)

OnUpstreamFailure(Exception, IContext) is called when upstream has signaled that the stream is completed with failure. It is not called if OnPull(TContext) or OnPush(TIn, TContext) of the stage itself throws an exception.

Note that elements that were emitted by upstream before the failure happened might not have been received by this stage when OnUpstreamFailure(Exception, IContext) is called, i.e. failures are not backpressured and might be propagated as soon as possible.

Here you cannot call Push(Object), because there might not be any demand from downstream. To emit additional elements before terminating you can use AbsorbTermination and push final elements from OnPull(TContext). The stage will then be in finishing state, which can be checked with IsFinishing.

(Inherited from AbstractStageTIn, TOut, TPushDirective, TPullDirective, TContext.)
Public methodOnUpstreamFinish(TContext)

This method is called when upstream has signaled that the stream is successfully completed. Here you cannot call Push(Object), because there might not be any demand from downstream. To emit additional elements before terminating you can use AbsorbTermination and push final elements from OnPull(TContext). The stage will then be in finishing state, which can be checked with IsFinishing.

By default the finish signal is immediately propagated with Finish.

IMPORTANT NOTICE: this signal is not back-pressured, it might arrive from upstream even though the last action by this stage was a "push".

(Inherited from AbstractStageTIn, TOut, TPushDirective, TPullDirective, TContext.)
Public methodOnUpstreamFinish(IContext)

This method is called when upstream has signaled that the stream is successfully completed. Here you cannot call Push(Object), because there might not be any demand from downstream. To emit additional elements before terminating you can use AbsorbTermination and push final elements from OnPull(TContext). The stage will then be in finishing state, which can be checked with IsFinishing.

By default the finish signal is immediately propagated with Finish.

IMPORTANT NOTICE: this signal is not back-pressured, it might arrive from upstream even though the last action by this stage was a "push".

(Inherited from AbstractStageTIn, TOut, TPushDirective, TPullDirective, TContext.)
Public methodPostStop
User overridable callback. Is called after the Stages final action is performed. Empty default implementation.
(Inherited from AbstractStageTIn, TOut.)
Public methodPreStart (Inherited from AbstractStageTIn, TOut.)
Public methodRestart
Used to create a fresh instance of the stage after an error resulting in a Restart directive. By default it will return the same instance untouched, so you must override it if there are any state that should be cleared before restarting, e.g. by returning a new instance.
(Inherited from AbstractStageTIn, TOut.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields
Extension Methods
See Also