Search Results for

    Show / Hide Table of Contents

    Class PushPullStage<TIn, TOut>

    PushPullStage<TIn, TOut> implementations participate in 1-bounded regions. For every external non-completion signal these stages produce *exactly one* push or pull signal.

    OnPush(TIn, IContext) is called when an element from upstream is available and there is demand from downstream, i.e. in OnPush(TIn, IContext) you are allowed to call Push(object) to emit one element downstream, or you can absorb the element by calling Pull(). Note that you can only emit zero or one element downstream from OnPull(IContext). To emit more than one element you have to push the remaining elements from OnPush(TIn, IContext), one-by-one. OnPush(TIn, IContext) is not called again until OnPull(IContext) has requested more elements with Pull().

    StatefulStage<TIn, TOut> has support for making it easy to emit more than one element from OnPush(TIn, IContext).

    OnPull(IContext)> is called when there is demand from downstream, i.e. you are allowed to push one element downstream with Push(object), or request elements from upstreams with Pull(). If you always perform transitive pull by calling Pull() from OnPull(IContext) you can use PushStage<TIn, TOut> instead of PushPullStage<TIn, TOut>.

    Stages are allowed to do early completion of downstream and cancel of upstream. This is done with StatefulStage.Finish, which is a combination of cancel/complete.

    Since OnComplete is not a backpressured signal it is sometimes preferable to push a final element and then immediately finish. This combination is exposed as PushAndFinish(object) which enables stages to propagate completion events without waiting for an extra round of pull.

    Another peculiarity is how to convert termination events (complete/failure) into elements. The problem here is that the termination events are not backpressured while elements are. This means that simply calling Push(object) as a response to OnUpstreamFinish(IContext) or OnUpstreamFailure(Exception, IContext) will very likely break boundedness and result in a buffer overflow somewhere. Therefore the only allowed command in this case is AbsorbTermination() which stops the propagation of the termination signal, and puts the stage in a IsFinishing state. Depending on whether the stage has a pending pull signal it has not yet "consumed" by a push its OnPull(IContext) handler might be called immediately or later. From OnPull(IContext) final elements can be pushed before completing downstream with StatefulStage.Finish or PushAndFinish(object).

    StatefulStage<TIn, TOut> has support for making it easy to emit final elements.

    All these rules are enforced by types and runtime checks where needed. Always return the Directive from the call to the IContext method, and do only call IContext commands once per callback.

    Inheritance
    object
    AbstractStage<TIn, TOut>
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>
    PushPullStage<TIn, TOut>
    PushStage<TIn, TOut>
    StatefulStage<TIn, TOut>
    Implements
    IStage<TIn, TOut>
    Inherited Members
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.Context
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.OnPush(TIn, IContext<TOut>)
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.OnPush(TIn, IContext)
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.OnPull(IContext<TOut>)
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.OnPull(IContext)
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.OnUpstreamFinish(IContext)
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.OnUpstreamFinish(IContext<TOut>)
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.OnDownstreamFinish(IContext, Exception)
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.OnDownstreamFinish(IContext<TOut>, Exception)
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.OnUpstreamFailure(Exception, IContext)
    AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>.OnUpstreamFailure(Exception, IContext<TOut>)
    AbstractStage<TIn, TOut>.IsDetached
    AbstractStage<TIn, TOut>.PreStart(ILifecycleContext)
    AbstractStage<TIn, TOut>.OnPush(TIn, IContext)
    AbstractStage<TIn, TOut>.OnPull(IContext)
    AbstractStage<TIn, TOut>.OnUpstreamFinish(IContext)
    AbstractStage<TIn, TOut>.OnDownstreamFinish(IContext, Exception)
    AbstractStage<TIn, TOut>.OnUpstreamFailure(Exception, IContext)
    AbstractStage<TIn, TOut>.PostStop()
    AbstractStage<TIn, TOut>.Decide(Exception)
    AbstractStage<TIn, TOut>.Restart()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Streams.Stage
    Assembly: Akka.Streams.dll
    Syntax
    [Obsolete("Please use GraphStage instead. [1.1.0]")]
    public abstract class PushPullStage<TIn, TOut> : AbstractStage<TIn, TOut, ISyncDirective, ISyncDirective, IContext<TOut>>, IStage<TIn, TOut>
    Type Parameters
    Name Description
    TIn

    TBD

    TOut

    TBD

    Implements

    IStage<TIn, TOut>

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)

    See Also

    DetachedStage<TIn, TOut>
    StatefulStage<TIn, TOut>
    PushStage<TIn, TOut>
    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