Hello Alexandre, First things first: There *must not* be multiple persistent actors in the system with the same persistentId. There must be exactly one persistent actor writing to the journal using a given persistent id.
Otherwise we can't guarantee any ordering. I mean you can start 2 separate systems, start actors with the same id on them, and start writing random conflicting things to the journal. Instead you should when creating persistentactors, use some kinds of repository that manages which actors are where etc. This is where patterns like ClusterSharding and ClusterSingleton help you to spread out these actors. Please check the docs here: http://doc.akka.io/docs/akka/2.3.4/contrib/cluster-sharding.html And yes, when a PersistentActor is moved around on the cluster it will be replayed - it will get all it's previous persistent events (or a snapshot), so your logic can simply assume "it's in the state it should be" and cake new writes - while being oblivious that a migration has just happened. On Mon, Jul 14, 2014 at 11:49 AM, Alexandre Delegue < [email protected]> wrote: > Thanks, I've watched the talk and it was pretty good. > What append when a new persistent actor start on a shard. Does it receive > all the message from the journal on the receiceRecover method or just a > subset filtered by the shardResolver ? > > Thanks, > Alex > > > Le samedi 12 juillet 2014 19:04:13 UTC+2, Alexandre Delegue a écrit : > >> Hi, >> >> I have some questions about akka persistence and scalabity and how to >> implement certain use case. >> >> The idea is to have an application that I can clone depending on the >> load. With akka persistence (event sourcing), if I clone an app I will have >> N persistents actor with the same persistent id : >> - If the journal is distributed each instance of persistent actor will >> write on the same journal. No problem if the order of the events stays the >> same. >> - If the state is persisted on DB, each node will share the same state. >> There is a problem when the persistent actor of each node start and replays >> the events from the journal, the state will be updated from different >> source and will be wrong. I can't persist the state on memory if I have to >> much element to deal with. >> >> What is the best way to deal with this problem ? >> >> For exemple if I have a shopping cart and the events are the actions the >> users can perform (create cart, add item, order ...) how can I scale that >> with akka persistence and event sourcing ? >> >> Thanks, >> Alex >> >> -- > >>>>>>>>>> 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. > -- Cheers, Konrad 'ktoso' Malawski hAkker @ Typesafe <http://typesafe.com> -- >>>>>>>>>> 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.
