Akka Persistence - callback for persistAll when all events have been saved

220 views
Skip to first unread message

Łukasz Gąsior

unread,
Feb 28, 2016, 9:23:36 AM2/28/16
to Akka User List
Hi,

Is there a way to execute a handler when all events have been saved using persistAll?
i.e. have (handler: Seq[A] => Unit) or even (handler: () => Unit)

Cheers,
Łukasz

Konrad Malawski

unread,
Feb 28, 2016, 9:50:55 AM2/28/16
to Akka User List

A defer() just after the persistAll call should pretty much be what you need, unless I missed something :)

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Łukasz Gąsior

unread,
Feb 28, 2016, 10:20:47 AM2/28/16
to Akka User List
Thanks! 
I think that's exactly what I need, and now that I know about it I see a section in docs right above 
"Nested persist calls", which I was looking at before posting my question.

Cheers

Aditya Prasad

unread,
Jun 10, 2016, 7:15:31 PM6/10/16
to Akka User List
Newb question: what if I don't have an event for the deferAsync() call? I just want to execute a block with the guarantee that it runs after persistAll() completes.

Patrik Nordwall

unread,
Jun 11, 2016, 11:30:55 AM6/11/16
to akka...@googlegroups.com
You need to pass something, but it can any object, e.g. a String that you don't use.

/Patrik

Aditya Prasad

unread,
Jun 13, 2016, 4:32:14 PM6/13/16
to akka...@googlegroups.com
Right-o, thanks :)

You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/nBlLieHIowI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages