c

akka.stream.stage

StatefulStage

abstract class StatefulStage[In, Out] extends PushPullStage[In, Out]

StatefulStage is a PushPullStage that provides convenience to make some things easier.

The behavior is defined in StageState instances. The initial behavior is specified by subclass implementing the #initial method. The behavior can be changed by using #become.

Use #emit or #emitAndFinish to push more than one element from StageState#onPush or StageState#onPull.

Use #terminationEmit to push final elements from #onUpstreamFinish or #onUpstreamFailure.

Annotations
@deprecated
Deprecated

(Since version 2.0-M2) StatefulStage is deprecated, please use GraphStage instead.

Source
Stage.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StatefulStage
  2. PushPullStage
  3. AbstractStage
  4. Stage
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new StatefulStage()

Type Members

  1. abstract class State extends StageState[In, Out]

    Scala API

Abstract Value Members

  1. abstract def initial: StageState[In, Out]

    Concrete subclass must return the initial behavior from this method.

    Concrete subclass must return the initial behavior from this method.

    **Warning:** This method must not be implemented as val.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from StatefulStage[In, Out] to any2stringadd[StatefulStage[In, Out]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (StatefulStage[In, Out], B)
    Implicit
    This member is added by an implicit conversion from StatefulStage[In, Out] to ArrowAssoc[StatefulStage[In, Out]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. final def become(state: StageState[In, Out]): Unit

    Change the behavior to another StageState.

  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def current: StageState[In, Out]

    Current state.

  10. def decide(t: Throwable): Supervision.Directive

    If an exception is thrown from #onPush this method is invoked to decide how to handle the exception.

    If an exception is thrown from #onPush this method is invoked to decide how to handle the exception. By default this method returns Supervision.Stop.

    If an exception is thrown from #onPull 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 when it is know how to recover from such exceptions.

    Definition Classes
    AbstractStage
  11. final def emit(iter: Iterator[Out], ctx: Context[Out], nextState: StageState[In, Out]): SyncDirective

    Java API: Can be used from StageState#onPush or StageState#onPull to push more than one element downstream and after that change behavior.

  12. final def emit(iter: Iterator[Out], ctx: Context[Out], nextState: StageState[In, Out]): SyncDirective

    Scala API: Can be used from StageState#onPush or StageState#onPull to push more than one element downstream and after that change behavior.

  13. final def emit(iter: Iterator[Out], ctx: Context[Out]): SyncDirective

    Java API: Can be used from StageState#onPush or StageState#onPull to push more than one element downstream.

  14. final def emit(iter: Iterator[Out], ctx: Context[Out]): SyncDirective

    Scala API: Can be used from StageState#onPush or StageState#onPull to push more than one element downstream.

  15. final def emitAndFinish(iter: Iterator[Out], ctx: Context[Out]): SyncDirective

    Java API: Can be used from StageState#onPush or StageState#onPull to push more than one element downstream and after that finish (complete downstreams, cancel upstreams).

  16. final def emitAndFinish(iter: Iterator[Out], ctx: Context[Out]): SyncDirective

    Scala API: Can be used from StageState#onPush or StageState#onPull to push more than one element downstream and after that finish (complete downstreams, cancel upstreams).

  17. def ensuring(cond: (StatefulStage[In, Out]) ⇒ Boolean, msg: ⇒ Any): StatefulStage[In, Out]
    Implicit
    This member is added by an implicit conversion from StatefulStage[In, Out] to Ensuring[StatefulStage[In, Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: (StatefulStage[In, Out]) ⇒ Boolean): StatefulStage[In, Out]
    Implicit
    This member is added by an implicit conversion from StatefulStage[In, Out] to Ensuring[StatefulStage[In, Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  19. def ensuring(cond: Boolean, msg: ⇒ Any): StatefulStage[In, Out]
    Implicit
    This member is added by an implicit conversion from StatefulStage[In, Out] to Ensuring[StatefulStage[In, Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  20. def ensuring(cond: Boolean): StatefulStage[In, Out]
    Implicit
    This member is added by an implicit conversion from StatefulStage[In, Out] to Ensuring[StatefulStage[In, Out]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  21. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  23. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  24. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from StatefulStage[In, Out] to StringFormat[StatefulStage[In, Out]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  25. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  26. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  27. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  28. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  29. final def notify(): Unit
    Definition Classes
    AnyRef
  30. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  31. def onDownstreamFinish(ctx: Context[Out]): TerminationDirective

    onDownstreamFinish is called when downstream has canceled.

    onDownstreamFinish is called when downstream has canceled.

    By default the cancel signal is immediately propagated with akka.stream.stage.Context#finish.

    Definition Classes
    AbstractStage
  32. final def onPull(ctx: Context[Out]): SyncDirective

    Invokes current state.

    Invokes current state.

    Definition Classes
    StatefulStageAbstractStage
  33. final def onPush(elem: In, ctx: Context[Out]): SyncDirective

    Invokes current state.

    Invokes current state.

    Definition Classes
    StatefulStageAbstractStage
  34. def onUpstreamFailure(cause: Throwable, ctx: Context[Out]): TerminationDirective

    onUpstreamFailure is called when upstream has signaled that the stream is completed with failure.

    onUpstreamFailure is called when upstream has signaled that the stream is completed with failure. It is not called if #onPull or #onPush 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 is called, i.e. failures are not backpressured and might be propagated as soon as possible.

    Here you cannot call akka.stream.stage.Context#push, because there might not be any demand from downstream. To emit additional elements before terminating you can use akka.stream.stage.Context#absorbTermination and push final elements from #onPull. The stage will then be in finishing state, which can be checked with akka.stream.stage.Context#isFinishing.

    Definition Classes
    AbstractStage
  35. def onUpstreamFinish(ctx: Context[Out]): TerminationDirective

    onUpstreamFinish is called when upstream has signaled that the stream is successfully completed.

    onUpstreamFinish is called when upstream has signaled that the stream is successfully completed. Here you cannot call akka.stream.stage.Context#push, because there might not be any demand from downstream. To emit additional elements before terminating you can use akka.stream.stage.Context#absorbTermination and push final elements from #onPull. The stage will then be in finishing state, which can be checked with akka.stream.stage.Context#isFinishing.

    By default the finish signal is immediately propagated with akka.stream.stage.Context#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”.

    Definition Classes
    StatefulStageAbstractStage
  36. def postStop(): Unit

    User overridable callback.

    User overridable callback.

    Is called after the Stages final action is performed. // TODO need better wording here Empty default implementation.

    Definition Classes
    AbstractStage
    Annotations
    @throws( classOf[Exception] )
  37. def preStart(ctx: LifecycleContext): Unit

    User overridable callback.

    User overridable callback.

    It is called before any other method defined on the Stage. Empty default implementation.

    Definition Classes
    AbstractStage
    Annotations
    @throws( classOf[Exception] )
  38. def restart(): Stage[In, Out]

    Used to create a fresh instance of the stage after an error resulting in a Supervision.Restart directive.

    Used to create a fresh instance of the stage after an error resulting in a Supervision.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.

    Definition Classes
    AbstractStage
  39. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  40. final def terminationEmit(iter: Iterator[Out], ctx: Context[Out]): TerminationDirective

    Java API: Can be used from #onUpstreamFinish or #onUpstreamFailure to push final elements downstream.

  41. final def terminationEmit(iter: Iterator[Out], ctx: Context[Out]): TerminationDirective

    Scala API: Can be used from #onUpstreamFinish to push final elements downstream before completing the stream successfully.

    Scala API: Can be used from #onUpstreamFinish to push final elements downstream before completing the stream successfully. Note that if this is used from #onUpstreamFailure the failure will be absorbed and the stream will be completed successfully.

  42. def toString(): String
    Definition Classes
    AnyRef → Any
  43. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. def [B](y: B): (StatefulStage[In, Out], B)
    Implicit
    This member is added by an implicit conversion from StatefulStage[In, Out] to ArrowAssoc[StatefulStage[In, Out]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from PushPullStage[In, Out]

Inherited from Stage[In, Out]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from StatefulStage[In, Out] to any2stringadd[StatefulStage[In, Out]]

Inherited by implicit conversion StringFormat from StatefulStage[In, Out] to StringFormat[StatefulStage[In, Out]]

Inherited by implicit conversion Ensuring from StatefulStage[In, Out] to Ensuring[StatefulStage[In, Out]]

Inherited by implicit conversion ArrowAssoc from StatefulStage[In, Out] to ArrowAssoc[StatefulStage[In, Out]]

Ungrouped