3

I'm trying to create some actors by using RoundRobinPool router:

workerRouter = 
   this.getContext().actorOf(new RoundRobinPool(5).props(Props.create(MyWorker.class)), "workerRouter");

But I cannot figure out how to assign a unique name to each created actor. Any idea?

Andi Pavllo
  • 2,506
  • 4
  • 18
  • 30
  • You could probably do something in the 'prestart' method as demostrated [here](https://doc.akka.io/docs/akka/current/routing.html#group) – code-colonel Jan 13 '20 at 04:39

1 Answers1

1

You cannot assign names to the actors created by a Pool Router. Messages are sent to the named router, which handles distributing the messages to the routees. See Akka in Action, Section 9.2.1

You can however assign names to actors in a Group Router, as you have to instantiate the routees yourself.

C_M
  • 51
  • 3