Represents the processing logic behind a GraphStage. Roughly speaking, a subclass of GraphStageLogic is a collection of the following parts:
- A set of InHandler and OutHandler instances and their assignments to the Inlets and Outlets of the enclosing GraphStage
- Possible mutable state, accessible from the InHandler and OutHandler callbacks, but not from anywhere else (as such access would not be thread-safe)
- The lifecycle hooks preStart and postStop
- Methods for performing stream processing actions, like pulling or pushing elements
The operator logic is completed once all its input and output ports have been closed. This can be changed by setting setKeepGoing to true.
The postStop lifecycle hook on the logic itself is called once all ports are closed. This is the only tear down callback that is guaranteed to happen, if the actor system or the materializer is terminated the handlers may never see any callbacks to onUpstreamFailure, onUpstreamFinish or onDownstreamFinish. Therefore operator resource cleanup should always be done in postStop.
Attributes
- Companion
- object
- Source
- GraphStage.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class TimerGraphStageLogicclass KillableGraphStageLogic
Members list
Type members
Classlikes
INTERNAL API
INTERNAL API
This allows the dynamic creation of an Inlet for a GraphStage which is connected to a Sink that is available for materialization (e.g. using the subFusingMaterializer). Completion, cancellation and failure of the parent operator is automatically delegated to instances of SubSinkInlet to avoid resource leaks.
To be thread safe this method must only be called from either the constructor of the graph operator during materialization or one of the methods invoked by the graph operator machinery, such as onPush and onPull.
Attributes
- Source
- GraphStage.scala
- Supertypes
-
class Objecttrait Matchableclass Any
INTERNAL API
INTERNAL API
This allows the dynamic creation of an Outlet for a GraphStage which is connected to a Source that is available for materialization (e.g. using the subFusingMaterializer). Completion, cancellation and failure of the parent operator is automatically delegated to instances of SubSourceOutlet to avoid resource leaks.
Even so it is good practice to use the timeout method to cancel this Outlet in case the corresponding Source is not materialized within a given time limit, see e.g. ActorMaterializerSettings.
To be thread safe this method must only be called from either the constructor of the graph operator during materialization or one of the methods invoked by the graph operator machinery, such as onPush and onPull.
Attributes
- Source
- GraphStage.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Constructors
Attributes
- Source
- GraphStage.scala
Concrete methods
Automatically invokes cancel or complete on all the input or output ports that have been called, then marks the stage as stopped.
Automatically invokes cancel or complete on all the input or output ports that have been called, then marks the stage as stopped.
Attributes
- Source
- GraphStage.scala
Automatically invokes cancel or complete on all the input or output ports that have been called, then marks the operator as stopped.
Automatically invokes cancel or complete on all the input or output ports that have been called, then marks the operator as stopped.
Attributes
- Source
- GraphStage.scala
Automatically invokes cancel or fail on all the input or output ports that have been called, then marks the operator as stopped.
Automatically invokes cancel or fail on all the input or output ports that have been called, then marks the operator as stopped.
Attributes
- Source
- GraphStage.scala
Obtain a callback object that can be used asynchronously to re-enter the current GraphStage with an asynchronous notification. The invoke method of the returned AsyncCallback is safe to be called from other threads. It will in the background thread-safely delegate to the passed callback function. I.e. invoke will be called by other thread and the passed handler will be invoked eventually in a thread-safe way by the execution environment.
Obtain a callback object that can be used asynchronously to re-enter the current GraphStage with an asynchronous notification. The invoke method of the returned AsyncCallback is safe to be called from other threads. It will in the background thread-safely delegate to the passed callback function. I.e. invoke will be called by other thread and the passed handler will be invoked eventually in a thread-safe way by the execution environment.
In case stream is not yet materialized AsyncCallback will buffer events until stream is available.
AsyncCallback.invokeWithFeedback has an internal promise that will be failed if event cannot be processed due to stream completion.
To be thread safe this method must only be called from either the constructor of the graph operator during materialization or one of the methods invoked by the graph operator machinery, such as onPush and onPull.
This object can be cached and reused within the same GraphStageLogic.
Attributes
- Source
- GraphStage.scala
Return true if the given output port is ready to be pushed.
Invoked after processing of external events stopped because the operator is about to stop or fail.
Invoked after processing of external events stopped because the operator is about to stop or fail.
Attributes
- Source
- GraphStage.scala
Invoked before any external events are processed, at the startup of the operator.
Invoked before any external events are processed, at the startup of the operator.
Attributes
- Source
- GraphStage.scala
Attributes
- Source
- GraphStage.scala
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
-
Any
- Source
- GraphStage.scala