abstract class StatefulHandler[State, Envelope] extends Handler[Envelope]
- Source
- StatefulHandler.scala
- Alphabetic
- By Inheritance
- StatefulHandler
- Handler
- HandlerLifecycle
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new StatefulHandler()
Abstract Value Members
- abstract def initialState(): CompletionStage[State]
Invoked to load the initial state when the projection is started or if previous
process
failed. - abstract def process(state: State, envelope: Envelope): CompletionStage[State]
The
process
method is invoked for eachEnvelope
.The
process
method is invoked for eachEnvelope
. One envelope is processed at a time. The returnedCompletionStage<State>
is to be completed when the processing of theenvelope
has finished. It will not be invoked with the next envelope until after the returnedCompletionStage
has been completed.The
state
is the completed value of the previously returnedCompletionStage<State>
or theinitialState
. If the previously returnedCompletionStage<State>
failed it will callinitialState
again and use that value.- Annotations
- @throws(classOf[Exception])
Concrete Value Members
- final def process(envelope: Envelope): CompletionStage[Done]
Calls
process(state, envelope)
with the completed value of the previously returnedCompletionStage<State>
or theinitialState
.Calls
process(state, envelope)
with the completed value of the previously returnedCompletionStage<State>
or theinitialState
. If the previously returnedCompletionStage<State>
failed it will callinitialState
again and use that value.- Definition Classes
- StatefulHandler → Handler
- final def start(): CompletionStage[Done]
Calls StatefulHandler.initialState when the projection is started.
Calls StatefulHandler.initialState when the projection is started.
- Definition Classes
- StatefulHandler → Handler → HandlerLifecycle
- def stop(): CompletionStage[Done]
Invoked when the projection has been stopped.
Invoked when the projection has been stopped. Can be overridden to implement resource cleanup. It is also called when the
Projection
is restarted after a failure.- Definition Classes
- Handler → HandlerLifecycle