Re: [akka-user] Akka Persistence and avoiding var in favor of context.become

2018-02-13 Thread Christopher Hunt
> On 13 Feb 2018, at 20:50, Christopher Hunt wrote: > > While receiveRecover is executing though, I presume that I’m going to have to > store the current state in a var…? Here’s what I’ve started with: > override def receiveRecover: Receive = { > case e: Event =>

Re: [akka-user] Akka Persistence and avoiding var in favor of context.become

2018-02-13 Thread Christopher Hunt
> On 13 Feb 2018, at 8:26 pm, Patrik Nordwall wrote: > > You have to do the right become transitions in the replay of the events, and > when consuming snapshots. Especially the latter is very easy to get wrong. > Thanks Patrik, that shouldn’t be an issue for my use

Re: [akka-user] Akka Persistence and avoiding var in favor of context.become

2018-02-13 Thread Patrik Nordwall
You have to do the right become transitions in the replay of the events, and when consuming snapshots. Especially the latter is very easy to get wrong. On Tue, Feb 13, 2018 at 10:23 AM, Christopher Hunt wrote: > On Friday, 15 September 2017 16:41:42 UTC+10, Konrad Malawski

Re: [akka-user] Akka Persistence and avoiding var in favor of context.become

2018-02-13 Thread Christopher Hunt
On Friday, 15 September 2017 16:41:42 UTC+10, Konrad Malawski wrote: > > I would recommend avoiding become with PersistentActors in general, it > gets very complex. > The Akka doc (1) suggests that the use of become should be fine. Are you able to expand on the complexity statement above? I'd

Re: [akka-user] Akka Persistence and avoiding var in favor of context.become

2017-09-15 Thread Konrad “ktoso” Malawski
Become “should" work AFAIR, though I’d recommend using Akka 2.5 (it’s binary compatible with 2.4, so you can just upgrade it). I could not find if we fixed anything about become in persistent Actors, there were fixes but a very long time ago in 2.3.. I would recommend avoiding become with

[akka-user] Akka Persistence and avoiding var in favor of context.become

2017-09-14 Thread Curt Siffert
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