Thank you Konard. I think a simpler example would help, esp. if its the first example in the documentation.
I'll submit a pull request for this soon. -Soumya On Friday, January 2, 2015 3:24:45 AM UTC-5, Konrad Malawski wrote: > > Hi there, > Your reasoning is correct - you usually do not keep all events in the > actor. This is just a simple example, not a full blown app. Maybe a better > example would be a summing actor here, as it does not have to keep all the > state. > > Feel free to open a ticket on akka/akka on github or submit a pull request > making this more clear :-) > > -- > Konrad 'ktoso' Malawski > (sent from my mobile) > On 2 Jan 2015 07:27, "Soumya Simanta" <[email protected] <javascript:>> > wrote: > >> I'm very new to Akka persistence, so please pardon me if this is a really >> simple question. >> >> In this example (part of the documentation >> <http://doc.akka.io/docs/akka/snapshot/scala/persistence.html>). Example >> state is defined as following. >> >> case class ExampleState(*events: List[String]* = Nil) { >> def updated(evt: Evt): ExampleState = copy(evt.data :: events) >> >> def size: Int = events.length >> >> override def toString: String = events.reverse.toString >> } >> >> >> events is a List[String] of all the events till *now*. Now imagine if >> the state of this actor was updated *a million times* then events will >> be a List of million Strings (which may put memory pressure in case of a >> large string values) >> >> My understanding is that we *don't* need to keep all the events inside >> the current state of the PersistentActor. It is stored on the journal (and >> snapshot) and can be replayed by the PersistantActor or ViewActor to >> recreate the current state in case of a crash or to create a view. >> >> Again, I understand in this example, ALL events are stored in the current >> state. >> But I don't see using this pattern (of storing all the events data in the >> current state) to represent state for real use cases. >> >> >> Thanks >> -Soumya >> >> >> -- >> >>>>>>>>>> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > -- >>>>>>>>>> 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.
