title: Akka: Send a future message to an Actor
body: <p>I have the following code inside an Actor</p>
  
  <pre><code>def receive = {
      case All() =&gt; {
          val collection: BSONCollection = db("ping")
          val future:Future[List[Ping]] = collection.find(BSONDocument()).cursor[Ping].toList()
          val zender = sender
          future onComplete {
              case Success(list) =&gt; zender ! list
              case Failure(throwable) =&gt; zender ! List()
          }
      }
  }
  </code></pre>
  
  <p>I don't like how I have to use the onComplete function to send the result back to the sender actor. I'd like to know if it is possible to convert it into something like this:</p>
  
  <pre><code>def receive = {
      case All() =&gt; {
          val collection: BSONCollection = db("ping")
          val future:Future[List[Ping]] = collection.find(BSONDocument()).cursor[Ping].toList()
          "sender ! future" // one option
          "future.map( list =&gt; sender ! list)" //Another option. I know it's not map, but maybe another function        
      }
  }
  </code></pre>
  
  <p>I feel that this flows better with future chaining.</p>