Learning akka persistence, I was initially reluctant to use vars to capture 
state since we generally try to avoid vars when possible. 

But when experimenting with context.become(receiveBlock(stateParam)) inside 
a receiveRecover implementation, it appeared to interfere with its ability 
to stash other messages. (akka 2.4.20) It tried to handle normal messages 
that it didn't try to handle when I wasn't using context.become.

Is it possible and reasonable to use context.become instead of var to 
capture state using Akka Persistence? At first glance, it seems like the 
interplay between receiveCommand and receiveRecover could get rather 
tricky, especially if your actor has initialization behavior that changes 
its receiveCommand behavior - for instance, initializing receiveCommand 
with an empty collection to start, i.e. 

def receiveCommand: Receive = initialReceive(List.empty)

Thanks,
Curt Siffert

-- 
>>>>>>>>>>      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+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to