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()(implicit ec: ExecutionContext)
Abstract Value Members
- abstract def initialState(): Future[State]
Invoked to load the initial state when the projection is started or if previous
process
failed. - abstract def process(state: State, envelope: Envelope): Future[State]
The
process
method is invoked for eachEnvelope
.The
process
method is invoked for eachEnvelope
. One envelope is processed at a time. The returnedFuture[State]
is to be completed when the processing of theenvelope
has finished. It will not be invoked with the next envelope until after the returnedFuture
has been completed.The
state
is the completed value of the previously returnedFuture[State]
or theinitialState
. If the previously returnedFuture[State]
failed it will callinitialState
again and use that value.
Concrete Value Members
- final def process(envelope: Envelope): Future[Done]
Calls
process(state, envelope)
with the completed value of the previously returnedFuture[State]
or theinitialState
.Calls
process(state, envelope)
with the completed value of the previously returnedFuture[State]
or theinitialState
. If the previously returnedFuture[State]
failed it will callinitialState
again and use that value.- Definition Classes
- StatefulHandler → Handler
- final def start(): Future[Done]
Calls StatefulHandler.initialState when the projection is started.
Calls StatefulHandler.initialState when the projection is started.
- Definition Classes
- StatefulHandler → HandlerLifecycle
- def stop(): Future[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
- HandlerLifecycle