title: How to send a message from other java controllers to an Akka actor in play?
body: <p>I've implemented a basic web socket example with Akka actor, this is the code i used in the Play framework application controller:</p>
  
  <pre><code>public static WebSocket&lt;String&gt; socket() {
      return WebSocket.whenReady((in, out) -&gt; {
          // create a new UserActor and give it the default stocks to watch
          final ActorRef messageActor = Akka.system().actorOf(Props.create(MyWebSocketActor.class, out),"SocketActor");
          // List&lt;String&gt; defaultStocks = Play.application().configuration().getStringList("default.stocks");
          // send all WebSocket message to the UserActor
          in.onMessage(message -&gt; {
              // parse the JSON into Stock.Watch
              messageActor.tell(message, ActorRef.noSender());
          });
          // on close, tell the userActor to shutdown
          in.onClose(() -&gt; {
              // kill actor
              Akka.system().stop(messageActor);
          });
      });
  }
  </code></pre>
  
  <p>Now in another controller, let's say a Messages controller, I want to pass a message to the actor, in order to push the message in the socket. So in the other controller I setup an ActorSelection: </p>
  
  <pre><code>ActorSelection myActorSel = Akka.system().actorSelection("SocketActor");
  Object message = "test";
  myActorSel.tell(message, ActorRef.noSender());
  </code></pre>
  
  <p>But I've got an error message, in the Akka logger:</p>
  
  <pre><code>Message from [] to [] was not delivered [1]. Dead letter encountered.
  </code></pre>
  
  <p>As I've found on internet this means that the actor is not accessible to the other controller or that the actor is not active any more.
  Someone point me out to setup a supervisor as a possible solution but, I've found any example in java. Could someone help me or point me out to some resources?</p>