I have a parent actor and children. Each child actors controlls a device. I give an uuid as to all child actors when I create them.
Each child actor is created by device configuration, when the configuration is changed, i would like to recreate the actor by:
stopping the old one:
final Future stopped = gracefulStop(actorRef, Duration.create(1, TimeUnit.SECONDS)); Await.result(stopped, Duration.create(1, TimeUnit.SECONDS));
recreating a new one:
context.actorOf(Props.create( GateActor.class, () -> new GateActor(hardwareRouterActorRef, settings)), settings.getUuid())
But it throws an exception:
akka.actor.InvalidActorNameException: actor name [6237255c-851b-47d2-ac31-03c7635e6537] is not unique!
I think the gracefulStop code not removes the children actor, my question is: how can I remove the child actor?
I have also tried to remove an actor by a PoisonPill:
actorRef.tell(PoisonPill.getInstance(), getSelf());