-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
Milestone
Description
akka.persistence.Eventsourced.persist javadoc documentation states:
It is guaranteed that no new commands will be received by a persistent actor between a call to persist
and the execution of its handler
.
However, in case an event is persisted from within the RecoveryCompleted message handler, the statement above does not hold. The following sequence of events happens:
- upon creation, the actor's receiveRecover handler gets the RecoveryCompleted message.
- in RecoveryCompleted message handler, persist an event E
- send a message X to the actor
- the actor's receiveCommand handler receives the message X, processes it
- only then the E's handler is invoked
While according to the specification, bullet number 4 must have occurred only after bullet 5.
A test application showcasing the issue is available at https://github.com/minisaw/akka-persistence-test
also another mention of the same problem:
https://stackoverflow.com/questions/36649466/akka-persist-on-recovery-completed-updates-state-after-first-message