Thanks Patrik. I came up with the same conclusion just before, but you've already answered 4 hours ago. I should have checked it earlier :) This behavior is common among aggregates, so it shouldn't be hard to implement in DRY way.
Also appreciate for this awesome extension! On Tuesday, December 17, 2013 5:36:42 PM UTC+9, Patrik Nordwall wrote: > > Hi Jisoo, > > > On Tue, Dec 17, 2013 at 7:23 AM, Jisoo Park <[email protected]<javascript:> > > wrote: > >> Hi, >> >> I'm playing around a bit with cluster sharding and considering trying it >> for my new service prototype. Although it'll start with only one node and >> doesn't have any scalability issue yet, I found this actor-per-entity model >> with built-in passivation support very useful when implementing DDD with >> Akka. >> >> It's very common in web applications that when a request comes in, the >> app checks whether requested resource exists and if not it returns 400 (Not >> Found) error. However, I couldn't found any way to ask for the existence of >> an entity to a ShardRegion. >> >> Currently, there are two possible workarounds: >> >> - Start each actor in 'empty' state by default. When a check message >> arrives before the state is changed by an explicit creation message, >> reply >> with negative result and stop the actor immediately. >> >> To be able to answer if the entity exists you have to try to load it > (from persistent storage) and the solution you suggest here is the way to > do that. The sharding infrastructure doesn't know if an entry is > non-existing or just passivated on disk, and I don't think don't think it > should or even can know that. > > Thanks for asking this interesting question. > > Regards, > Patrik > > >> >> - Maintain global or per-cluster singleton registry. >> >> Or we might add a feature to ShardRegion checking the existence of an >> entity by its id. What do you think? >> >> Regards, >> Jisoo >> >> -- >> >>>>>>>>>> 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] <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/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.
