+act add getEventStream to ActorSystem #25870

This commit is contained in:
kerr 2018-11-09 19:29:05 +08:00 committed by Johan Andrén
parent f66ee1cbe8
commit e847ce016a
6 changed files with 26 additions and 21 deletions

View file

@ -99,7 +99,7 @@ class ExamplePersistentActor extends AbstractPersistentActor {
final Evt evt = new Evt(data + "-" + getNumEvents());
persist(evt, (Evt e) -> {
state.update(e);
getContext().getSystem().eventStream().publish(e);
getContext().getSystem().getEventStream().publish(e);
if (lastSequenceNr() % snapShotInterval == 0 && lastSequenceNr() != 0)
// IMPORTANT: create a copy of snapshot because ExampleState is mutable
saveSnapshot(state.copy());