As you mentioned above actorOf creates new actor that is okay
what is the use of this line FromConfig.getInstance().props
What it does ??
ActorRef workerRouter = getContext().actorOf( FromConfig.getInstance().props(Props.create(StatsWorker.class)),
“workerRouter”);
Also one more question,
In the same example StatsSampleClient.java we are storing the address of each member into Set through which we are sending msg to an Actor for every 2 second.
My use case
Instead of sending msg to an actor I want to send a msg to cluster from which It should automatically redirect to any one of the Actor which is currently available.
Hope you understand my question…
akka.router.FromConfig.getInstance() gets an object that can be used to create routers based on the configuration. The scaladoc is here, unfortunately it doesn’t seem to appear correctly in the javadoc, I filed this ticket for that.
Then .props(Props.create(StatsWorker.class)) creates the Props to create a router that routes to a pool of actors that are created with Props.create(StatsWorker.class).