Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Akka + Java: set actors name while using RoundRobinPool

Tags:

java

akka

actor

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?

like image 206
Andi Pavllo Avatar asked Dec 20 '25 11:12

Andi Pavllo


1 Answers

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.

like image 186
C_M Avatar answered Dec 22 '25 23:12

C_M