I want to send a reply after I have persisted and updated the state of the actor using persistAll. Unfortunately I have not found a callback or onSucces handler to send back a reply after the last event has been persisted.
Asked
Active
Viewed 216 times
0
-
share some come with what you are trying to achieve, it is better to work with some common code – Emiliano Martinez Aug 15 '18 at 08:51
1 Answers
0
This is a shortcoming of the API, there is no built in way to react on all persistAll completing, you will have to keep a counter or a set of completed persists yourself and only trigger your logic when the last persist completes.
As far as I remember this cannot be easily fixed because it would break binary and source compatibility.
In the "next generation" persistent actors (in Akka typed) this works more as you would expect and the side effect you want to execute on successful persist of the events will only execute once, when all the events are complete.

johanandren
- 11,249
- 1
- 25
- 30