On Fri, Feb 28, 2014 at 7:27 AM, Martin Krasser <[email protected]>wrote:
> > On 28.02.14 04:47, Richard Rodseth wrote: > > Can I follow up on my other naive questions? I'm basically trying to get a > feel for what a DDD sample would look like *without* the cluster and > sharding, where we can't assume we have sufficient memory for all aggregate > instances at once. > > I see in the EventSourcedExample of the akka-sample-persistence-scala > template that the processor actor (I think we might need a better name than > "processor") is instantiated with a name, and that the state persists > across multiple runs of the application. > val processor = system.actorOf(Props[ExampleProcessor], > "processor-4-scala") > i.e. the persistent log must be associated with "processor-4-scala") ? > > > yes it is. > > > > So presumably an aggregate factory/repository could assign a GUID or > something to each aggregate instance (actor), perhaps cache a limited > number of them and on subsequent loads new instances of the actor class > could get instantiated and would be associated with the right persistent > event stream. Am I making any sense? > > > yes, this should work. Just use the GUID as processorID. > on a related note: cluster sharding also supports passivation of aggregate instances. The actor is stopped and memory is released. When used next time its state is recovered from persistent events. The trick is to send all messages via a parent manager actor (factory/repository or whatever you choose to call it). /Patrik > > > > > > On Fri, Feb 21, 2014 at 11:24 PM, Patrik Nordwall < > [email protected]> wrote: > >> >> >> >> On Sat, Feb 22, 2014 at 1:03 AM, Richard Rodseth <[email protected]>wrote: >> >>> Another bit of feedback. >>> >>> Is there a way to inject the "listing" ActorRef into Post, or include >>> it in a message, so that the Post code is not cluster-aware? >>> >> >> That is a very good suggestion. Add the listing: ActorRef as >> constructor parameter, and specify it in the entryProps when starting the >> region. >> >> ClusterSharding(system).start( >> typeName = Post.shardName, >> entryProps = Some(Props(classOf[Post], >> ClusterSharding(system).shardRegion(AuthorListing.shardName))), >> idExtractor = Post.idExtractor, >> shardResolver = Post.shardResolver) >> >> AuthorListing must be be started first. >> >> Thank you for the feedback. >> >> Regards, >> Patrik >> >> >>> >>> >>> On Fri, Feb 21, 2014 at 3:19 PM, Richard Rodseth <[email protected]>wrote: >>> >>>> Hi Patrik >>>> >>>> I should have just said "different". I'm not saying your design is >>>> wrong. But you must admit that much of the design guidance that is offered >>>> for actors says "think of an actor as a person". And certainly in a >>>> traditional DDD app your aggregates aren't these autonomous things >>>> operating concurrently. Now we have entities as actors, and with the >>>> clustered sharding the "factory" as well as the supervision is all behind >>>> the scenes (apparently). I'm confident it's going to be a great way to >>>> build apps - just going through a learning process. Keep up the good work. >>>> >>>> >>>> On Fri, Feb 21, 2014 at 2:54 PM, Patrik Nordwall < >>>> [email protected]> wrote: >>>> >>>>> Hi, >>>>> >>>>> On Fri, Feb 21, 2014 at 10:42 PM, Richard Rodseth <[email protected] >>>>> > wrote: >>>>> >>>>>> I have now read the sharding documentation, and this in the template. >>>>>> Sorry I jumped the gun in my excitement :) >>>>>> >> >>>>>> To send messages to the identifier of the Post actor you need to >>>>>> send them via the shardRegion actor, which can be retrieved via the >>>>>> ClusterSharding extension. The sharding feature knows how to route >>>>>> the message and it will on demand allocate the Post actors to >>>>>> cluster nodes and create the actor instances. Exactly how this works >>>>>> under >>>>>> the hood is described in the >>>>>> documentation<http://doc.akka.io/docs/akka/2.3.0-RC4/contrib/cluster-sharding.html> >>>>>> . >>>>>> << >>>>>> It still feels a bit weird to think of actors as "entries" rather >>>>>> than workers. >>>>>> >>>>>> >>>>> Thanks for trying the new activator template [1]. >>>>> >>>>> Weird? For me, an actor can be a consistency boundary with a >>>>> meaningful identity and continuity through a life cycle, i.e. an Entity or >>>>> Aggregate. >>>>> >>>>> Not all actors are like that of course, others are workers, >>>>> services, ... >>>>> >>>>> /Patrik >>>>> >>>>> [1] >>>>> http://typesafe.com/activator/template/akka-cluster-sharding-scala >>>>> >>>>> >>>>>> >>>>>> >>>>>> On Fri, Feb 21, 2014 at 12:28 PM, Richard Rodseth <[email protected] >>>>>> > wrote: >>>>>> >>>>>>> I'm excited to see the new cluster-sharding activator template, >>>>>>> which I think might address some of the confusion I've had about >>>>>>> eventsourced DDD with an actor per aggregate root. >>>>>>> >>>>>>> Do I understand correctly that the actual instantiation of the >>>>>>> Post processor actor is something that happens within the >>>>>>> ClusterSharding >>>>>>> pattern (which I confess I haven't studied yet). Perhaps that could be >>>>>>> called out in the text. >>>>>>> >>>>>>> Is it fair to say the the actor-per-aggregate root approach >>>>>>> *presumes* a memory image model which then implies sharding and hence >>>>>>> the >>>>>>> use of Akka cluster? >>>>>>> >>>>>>> Is there or will there be a non-clustered version of the same app? >>>>>>> That might be instructive for those of us trying to wrap our heads >>>>>>> around >>>>>>> DDD, Event Sourcing, CQRS and Akka all at once :) >>>>>>> >>>>>>> I look forward to digging in further, but obviously have a lot to >>>>>>> learn. Thanks for the template! >>>>>>> >>>>>> >>>>>> -- >>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>> >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>>> >>>>>>>>>> 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/groups/opt_out. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> >>>>> Patrik Nordwall >>>>> Typesafe <http://typesafe.com/> - Reactive apps on the JVM >>>>> Twitter: @patriknw >>>>> -- >>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>> >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>> >>>>>>>>>> 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/groups/opt_out. >>>>> >>>> >>>> >>> -- >>> >>>>>>>>>> Read the docs: http://akka.io/docs/ >>> >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>> >>>>>>>>>> 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/groups/opt_out. >>> >> >> >> >> -- >> >> Patrik Nordwall >> Typesafe <http://typesafe.com/> - Reactive apps on the JVM >> Twitter: @patriknw >> -- >> >>>>>>>>>> Read the docs: http://akka.io/docs/ >> >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >> >>>>>>>>>> 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/groups/opt_out. >> > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: http://akka.io/faq/ > >>>>>>>>>> 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/groups/opt_out. > > > -- > Martin Krasser > > blog: http://krasserm.blogspot.com > code: http://github.com/krasserm > twitter: http://twitter.com/mrt1nz > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: http://akka.io/faq/ > >>>>>>>>>> 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/groups/opt_out. > -- Patrik Nordwall Typesafe <http://typesafe.com/> - Reactive apps on the JVM Twitter: @patriknw -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>>>>>>> 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/groups/opt_out.
