You can, but you have to ensure that that name is unique in this context. Specifically, each of the child Actors of a given parent must have a unique name within that parent. So this error is saying that one of your entities is trying to create multiple children with the same name.
If you want to set the name, you're going to have to do it algorithmically in some way to make sure that it's unique per-entity. On Mon, Jan 30, 2017 at 9:44 AM, Dai Yinhua <yhdai.2...@gmail.com> wrote: > Hi team, > > I'm using cluster sharding to process request from client. > My entity actor is actually some factory actor, which means it will create > different actors based on the request parameters, and I will set a name for > each actor. > Example code as below: > > if(ricRequestMsg.mAppId == > AnalyticsAppId.MKTDIGEST) { > ActorRef appActor = getContext().actorOf(Props.create(MktDigestActor.class), > "mktdigestactor"); > appActor.forward(message, getContext()); > } > > The problem is that when it receives the same request message twice, it > will report exception: > akka.actor.InvalidActorNameException: actor name [mktdigestactor] is not > unique! > > And the actor is stopped. > > Does that means I can't set the name for the created actor? > > -- > >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com. > To post to this group, send email to akka-user@googlegroups.com. > 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 akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.