=doc #3924 Doc how to be notified when recovery completed

This commit is contained in:
Patrik Nordwall 2014-03-24 15:35:54 +01:00
parent 4ba1bc46fb
commit c1f7d7fa21
7 changed files with 132 additions and 4 deletions

View file

@ -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 {