2

I am new to Akka and I am bulding a cluster system with many remote nodes. The remote nodes are called workers. Workers create chain of remote routers.

The parent(Worker) which creates routers will have a stats watcher who will get message from all routees of routers.

The qn is : Is is good practise to pass statswatcher actorRef while creating routers as constructor argument of the router or just pass actor path of statswatcher as constructor argument and user actor selection in router to tell message.

**************** UPDATE ********

As per reply from akka mailing group replies passing actor ref as constructor argument is not a bad practice. Actor selection is useful for remote actor lookup.

Harshjags
  • 163
  • 1
  • 2
  • 12
  • Possible duplicate of [Is passing around ActorRef to other Actors good or bad ?](http://stackoverflow.com/questions/24840608/is-passing-around-actorref-to-other-actors-good-or-bad) – bluenote10 Mar 23 '17 at 22:47

1 Answers1

0

Passing actorrefs is perfectly fine, and recommended. ActorSelection is pretty expensive, and you can target a single JVM only, not the whole cluster.

Igmar Palsenberg
  • 637
  • 4
  • 10