=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

@ -130,6 +130,46 @@ public class LambdaPersistenceDocTest {
);
}
}
//#recovery-completed
class MyProcessor5 extends AbstractProcessor {
public MyProcessor5() {
receive(ReceiveBuilder.
matchEquals("FIRST", s -> {
recoveryCompleted();
getContext().become(active);
unstashAll();
}).
matchAny(message -> {
if (recoveryFinished()) {
stash();
} else {
active.apply(message);
}
}).
build()
);
}
@Override
public void preStart() throws Exception {
super.preStart();
self().tell("FIRST", self());
}
private void recoveryCompleted() {
// perform init after recovery, before any other messages
// ...
}
PartialFunction<Object, BoxedUnit> active =
ReceiveBuilder.
match(Persistent.class, message -> {/* ... */}).
build();
}
//#recovery-completed
};
static Object o3 = new Object() {