title: How to name an actor?
body: <p>The data layer in my web application is comprised of Akka actors.  Whenever I need to access data, I invoke the ActorSystem mechanism like so:</p>
  
  <pre><code>val myActor = system.actorOf(Props[MyActor], name = "myactor")      
  implicit val timeout = Timeout(120 seconds)
  val future = myActor ? Request1
  val result = Await.result(future, timeout.duration)
  </code></pre>
  
  <p>I'm using Play, and the ActorSystem variable is obtained through injection:</p>
  
  <pre><code>class MyClass @Inject() (system: ActorSystem)
  </code></pre>
  
  <p>But I'm getting the following exception saying that the actor name is not unique the <strong>second</strong> time I access the function, how to fix this? How to name the actor, taking into account that can be used concurrently by more than one thread?</p>
  
  <blockquote>
    <p>play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution
    exception[[InvalidActorNameException: actor name [myactor] is not
    unique!]]</p>
  </blockquote>
  
  <p>** <strong>EDIT</strong> **</p>
  
  <p>What I'm trying to achieve is something similar to having a container of Entity Beans in the EJB model, where each actor would be an Entity Bean. The difference I'm noticing is that the actors are not created/destroyed automatically as needed.</p>