abstract class AbstractStage[-In, Out, PushD <: Directive, PullD <: Directive, Ctx <: Context[Out], LifeCtx <: LifecycleContext] extends Stage[In, Out]
- Annotations
- @deprecated
- Deprecated
(Since version 2.4.2) Please use GraphStage instead.
- Source
- Stage.scala
- Alphabetic
- By Inheritance
- AbstractStage
- Stage
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new AbstractStage()
Abstract Value Members
-
abstract
def
onPull(ctx: Ctx): PullD
onPull
is called when there is demand from downstream, i.e.onPull
is called when there is demand from downstream, i.e. you are allowed to push one element downstream with akka.stream.stage.Context#push, or request elements from upstreams with akka.stream.stage.Context#pull -
abstract
def
onPush(elem: In, ctx: Ctx): PushD
onPush
is called when an element from upstream is available and there is demand from downstream, i.e.onPush
is called when an element from upstream is available and there is demand from downstream, i.e. inonPush
you are allowed to call akka.stream.stage.Context#push to emit one element downstream, or you can absorb the element by calling akka.stream.stage.Context#pull. Note that you can only emit zero or one element downstream fromonPull
.To emit more than one element you have to push the remaining elements from #onPull, one-by-one.
onPush
is not called again untilonPull
has requested more elements with akka.stream.stage.Context#pull.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx] to any2stringadd[AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx], B)
- Implicit
- This member is added by an implicit conversion from AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx] to ArrowAssoc[AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
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. -
def
ensuring(cond: (AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]) ⇒ Boolean, msg: ⇒ Any): AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]
- Implicit
- This member is added by an implicit conversion from AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx] to Ensuring[AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]) ⇒ Boolean): AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]
- Implicit
- This member is added by an implicit conversion from AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx] to Ensuring[AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]
- Implicit
- This member is added by an implicit conversion from AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx] to Ensuring[AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]
- Implicit
- This member is added by an implicit conversion from AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx] to Ensuring[AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx] to StringFormat[AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
onDownstreamFinish(ctx: Ctx): 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.
-
def
onUpstreamFailure(cause: Throwable, ctx: Ctx): 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.
-
def
onUpstreamFinish(ctx: Ctx): 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”.
-
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.
- Annotations
- @throws( classOf[Exception] )
-
def
preStart(ctx: LifeCtx): Unit
User overridable callback.
User overridable callback.
It is called before any other method defined on the
Stage
. Empty default implementation.- Annotations
- @throws( classOf[Exception] )
-
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.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
→[B](y: B): (AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx], B)
- Implicit
- This member is added by an implicit conversion from AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx] to ArrowAssoc[AbstractStage[In, Out, PushD, PullD, Ctx, LifeCtx]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc