On Wed, Mar 25, 2015 at 11:55 AM, Patrik Nordwall <[email protected] > wrote:
> Hi Amir, > > On Sun, Mar 22, 2015 at 8:57 PM, Amir Karimi <[email protected]> wrote: > >> Hi, >> >> I have an actor with multiple states. What is the best practice to save >> snapshots of them: >> >> - Aggregating all states into one case class and just have a single >> big state object >> - This is hard when we have to update deeper states. Like >> "state.copy(innerState = state.innerState.copy(...))" >> >> And for updating deep case class hierarchies you can use lens pattern from scalaz or monocle or something simpler like quicklens <http://www.warski.org/blog/2015/02/quicklens-modify-deeply-nested-case-class-fields/> . > This is the way to do it. I see no other way. > Note that the state object that you pass to saveSnapshot doesn't have to > be the same as the state object you have in your actor. You can have > several state variables in the actor and then combine them into one object > when you perform saveSnapshot. > > >> >> - Call saveSnapshot for each state object >> - I'm not sure what happens if one of the snapshot savings fail >> >> This will not work. When the actor is recovering it will only receive one > snapshot followed by the events after that snapshot. > > /Patrik > > >> What is the best solution? >> >> Thanks, >> Amir >> >> -- >> >>>>>>>>>> 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 [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > > Patrik Nordwall > Typesafe <http://typesafe.com/> - Reactive apps on the JVM > Twitter: @patriknw > > -- > >>>>>>>>>> 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- Martynas Mickevičius Typesafe <http://typesafe.com/> – Reactive <http://www.reactivemanifesto.org/> Apps on the JVM -- >>>>>>>>>> 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
