title: Akka : the proper use of `ask` pattern?
body: <p>I'm trying to grok <code>Futures</code> and ask pattern in akka. </p>
  
  <p>So, I make two actors, and one asking another to send him back a message. Well, according to akka's <code>Futures</code> documentation, actor should <em>ask</em>(<code>?</code>) for message and it shall give him a <code>Future</code> instanse. Then actor should block (using <code>Await</code>) to get <code>Future</code> results. </p>
  
  <p>Well, I never get my future done. Why is that?</p>
  
  <p>Code is:</p>
  
  <pre><code>package head_thrash
  
  import akka.actor._
  import akka.util.Timeout
  import scala.concurrent.Await
  import scala.concurrent.duration._
  
  object Main extends App {
  
    val system = ActorSystem("actors")
  
    val actor1 = system.actorOf(Props[MyActor], "node_1")
    val actor2 = system.actorOf(Props[MyActor], "node_2")
  
    actor2 ! "ping_other"
  
    system.awaitTermination()
  
    Console.println("Bye!")
  }
  
  class MyActor extends Actor with ActorLogging {
    import akka.pattern.ask
  
    implicit val timeout = Timeout(100.days)
  
    def receive = {
      case "ping_other" =&gt; {
        val selection = context.actorSelection("../node_1")
        log.info("Sending ping to node_1")
        val result = Await.result(selection ? "ping", Duration.Inf) // &lt;-- Blocks here forever!
        log.info("Got result " + result)
      }
      case "ping" =&gt; {
        log.info("Sending back pong!")
        sender ! "pong"
      }
    }
  }
  </code></pre>
  
  <p>If I change <code>Duration.Inf</code> to <code>5.seconds</code>, then actor waits 5 seconds, tells that my future is <em>Timeouted</em> (by throwing <code>TimeoutException</code>), and then other actor finally replies with needed message. So, no async happens. Why? :-( </p>
  
  <p>How should I properly implement that pattern? Thanks.</p>