title: Is passing around ActorRef to other Actors good or bad ?
body: <p>I'm trying to figure out if my usage of passing Akka <code>ActorRef</code> around to other actors is not an anti-pattern.</p>
  
  <p>I've a few actors in my system. Some are long lived (<code>restClientRouter</code>,<code>publisher</code>) and some die after that they have done the work (<code>geoActor</code>). The short-lived actors need to send messages to the long-lived actors and therefore need their <code>ActorRef</code>s.</p>
  
  <pre><code>  //router for a bunch of other actors
    val restClientRouter = createRouter(context.system)
  
    //publishers messages to an output message queue
    val publisher: ActorRef = context.actorOf(Props(new PublisherActor(host, channel)), name = "pub-actor")     
  
    //this actor send a message to the restClientRouter and then sends the response
    //to the publisher 
    val geoActor = context.actorOf(Props(new GeoInferenceActor(restClientRouter, publisher)), name = "geo-inference-actor")
  </code></pre>
  
  <p>As you can see I'm passing the ActorRefs (<code>restClientRouter</code> and <code>publisher</code>) to the constructor of <code>GeoInferenceActor</code>. Is this okay or not? Is there a better way of doing this ? </p>