=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
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue