Class DetachedStage<TIn, TOut>
DetachedStage can be used to implement operations similar to Buffer<TIn, TOut, TMat>(Flow<TIn, TOut, TMat>, Int32, OverflowStrategy), Expand<TIn, TOut1, TOut2, TMat>(Flow<TIn, TOut1, TMat>, Func<TOut1, IEnumerator<TOut2>>) and Conflate<TIn, TOut, TMat>(Flow<TIn, TOut, TMat>, Func<TOut, 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.
Implements
Inherited Members
Namespace: Akka.Streams.Stage
Assembly: Akka.Streams.dll
Syntax
[Obsolete("Please use GraphStage instead. [1.1.0]")]
public abstract class DetachedStage<TIn, TOut> : AbstractStage<TIn, TOut, IUpstreamDirective, IDownstreamDirective, IDetachedContext<TOut>>, IStage<TIn, TOut>
Type Parameters
Name | Description |
---|---|
TIn | TBD |
TOut | TBD |
Properties
| Improve this Doc View SourceIsDetached
TBD
Declaration
protected override bool IsDetached { get; }
Property Value
Type | Description |
---|---|
Boolean |