Update deferAsync doc #20873
This commit is contained in:
parent
aa5a27182e
commit
e82d2c2817
6 changed files with 72 additions and 7 deletions
|
|
@ -422,6 +422,41 @@ public class LambdaPersistenceDocTest {
|
|||
}
|
||||
};
|
||||
|
||||
static Object o100 = new Object() {
|
||||
//#defer-with-persist
|
||||
class MyPersistentActor extends AbstractPersistentActor {
|
||||
|
||||
@Override public String persistenceId() {
|
||||
return "my-stable-persistence-id";
|
||||
}
|
||||
|
||||
private void handleCommand(String c) {
|
||||
persist(String.format("evt-%s-1", c), e -> {
|
||||
sender().tell(e, self());
|
||||
});
|
||||
persist(String.format("evt-%s-2", c), e -> {
|
||||
sender().tell(e, self());
|
||||
});
|
||||
|
||||
deferAsync(String.format("evt-%s-3", c), e -> {
|
||||
sender().tell(e, self());
|
||||
});
|
||||
}
|
||||
|
||||
@Override public Receive createReceiveRecover() {
|
||||
return receiveBuilder().
|
||||
match(String.class, this::handleCommand).build();
|
||||
}
|
||||
|
||||
@Override public Receive createReceive() {
|
||||
return receiveBuilder().
|
||||
match(String.class, this::handleCommand).build();
|
||||
}
|
||||
}
|
||||
//#defer-with-persist
|
||||
|
||||
};
|
||||
|
||||
static Object o11 = new Object() {
|
||||
|
||||
class MyPersistentActor extends AbstractPersistentActor {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue