You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
there's one more quirk, though: the event handler will not be invoked at all in case no message is sent to the actor. so the problem is not only in that the commands are not stashed (as #21736 states).
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 itshandler
.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:
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
The text was updated successfully, but these errors were encountered: