Helle everyone, i just started to playing around with akka and its persistence and i have few questions about collections and other stuff.
For example lets assume that i am building blog which obviously contains a blog entries. So i have two options: - I can create one *BlogActor* that extends* PersistentActor* and store all blog entries as collection (not for reads, but for some domain logic if it had one). Drawback for this is that it becomes monolith. - Or i could have *BlogActor *that would be regular actor and delegate commands further to *BlogPostActor* (extends *PersistentActor*). And as collection would be held collection of *ActorRef*s (with some magic it could be done that idle actors could be killed and reinstantiated on demand) Second option seems more logical to me, but than i have to create those unique actor names and persistence ids: // With in BlogActor creating new BlogPostActor context.actorOf(BlogPost.props, "post" + postId ) // Within BlogPostActor override def persistenceId: String = self.path.parent.name + "." + self.path .name I have found in a few tutorials that for persistenceId are used parent and self path names. Is it ok or are there better ways for that? One draw back i see is for persistenceViews. I will need to create new view actor for each blog post actor (1:1). Are there any abstractions to that? About views in general in my current application i have views that are build out of events from different entities and even different types of entities. I have view where i need to show author name and blog posts count it has written, so when author changes name this view must be updated, and when new blog post is added or removed this view also needs to be updated. In my current app i have view that can listen to all events with in its domain and choose unto which events it wants to correspond. It would be great for something similar in akka persistence. Drawbacks i can see with this approach (if views are stored with in memory) that there will be a lot memory wasted holding duplicate states data, holding data that needs to be accessed rarely. It could be something like i mentioned above where idle views could be killed and reinstantiated on demand but if view needs to reinstantiate from all domain events not just persistenceId it could take a while (reads must be fast). Is it possible with akka persistance views? Scala and Akka is something entirely new for me = mind blown. -- >>>>>>>>>> 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.
