=doc #3924 Doc how to be notified when recovery completed
This commit is contained in:
parent
4ba1bc46fb
commit
c1f7d7fa21
7 changed files with 132 additions and 4 deletions
|
|
@ -84,6 +84,35 @@ trait PersistenceDocSpec {
|
|||
}
|
||||
//#deletion
|
||||
}
|
||||
|
||||
class MyProcessor4 extends Processor {
|
||||
//#recovery-completed
|
||||
override def preStart(): Unit = {
|
||||
super.preStart()
|
||||
self ! "FIRST"
|
||||
}
|
||||
|
||||
def receive = initializing.orElse(active)
|
||||
|
||||
def initializing: Receive = {
|
||||
case "FIRST" =>
|
||||
recoveryCompleted()
|
||||
context.become(active)
|
||||
unstashAll()
|
||||
case other if recoveryFinished =>
|
||||
stash()
|
||||
}
|
||||
|
||||
def recoveryCompleted(): Unit = {
|
||||
// perform init after recovery, before any other messages
|
||||
// ...
|
||||
}
|
||||
|
||||
def active: Receive = {
|
||||
case Persistent(msg, _) => //...
|
||||
}
|
||||
//#recovery-completed
|
||||
}
|
||||
}
|
||||
|
||||
new AnyRef {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue