Hi Leonti 1. It will start an actor for a user on demand, based on you doing something like context.actorOf(Props(classOf[UserActor], userId), s"user-$userId"). The actor will replay all of its events unless you've implemented it to take snapshot offers. You could eagerly start all actors if you needed to but this would be unusual IMO.
2. To get all events from the beginning, see PersistenceQuery. You can choose your start point, and this will work across aggregates for the whole journal, in fact to query particular types of events you have to jump through a few hoops (EventAdapters to tag them for example). Branislav Lazic put together an example application I found really helpful here: https://github.com/BranislavLazic/akka-cqrs-activator Hope that helps Brian On 26 July 2017 at 08:56, Leonti Bielski <[email protected]> wrote: > Hi! > > I'm looking at Akka Persistence for Event Sourcing and I have a couple > questions that I couldn't find an answer to. > > Lets say I have an aggregate named User > > 1. As far as I understand persistenceId would be an aggregate id, which > is an id of a user. > Let's say I have a million users - will Akka start 1 million actors when I > start the server or it only creates actors on demand? > > 2. How do I ask for all of the event for all time? > For example if I decide to create a new View/projection I would like to > populate all of the data. > Or if I have another system which would like to populate it's cache using > my events. > Is it possible with Akka Persistence? > > In our custom-built Event Store based on SQL db we have global sequence > id, so if I want to rebuild a view from scratch I would just do a query for > all events starting form a certain sequence id. > As far as I understand in Akka Persistence sequence number is only valid > inside of a single stream/aggregate id. > I see how I can replay events for a particular aggregate(user in my case), > but I would need to know the user id in the first place. > Not sure how would I do that not only with Akka Persistence but in general > with Event Stores which don't have global sequence id so I can't just query > for all events for all aggregates. > > Cheers, > Leonti > > > > -- > >>>>>>>>>> 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 https://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 https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
