title: Return Future Message from an Actor
body: <p>I have an existing <code>API</code> which returns a <code>Future</code>. Now introducing an <code>Actor</code> for one of the use cases and trying to continue using same service <code>API</code> from it. From below you can see <code>MyService.saveValues</code> return future. </p>
  
  <pre><code>object MyActor {
     implicit val ec = scala.concurrent.ExecutionContext.Implicits.global
     implicit val timeout = Timeout(1 second)
     case class SampleMessage(list: List[String])
     val actorSystem =  //get actorSystem that was created at the startup
  
  
    def saveMessage(list: List[String])  ={
      val res = (actorSystem.actorOf(Props[MyActor]) ? SaveMyMessage(list) ).mapTo[Future[\/[Throwable,String]]
   //res map{ r=&gt;
  
   //}
  
   }
  }
  class MyActor extends Actor {
  import MyActor._
  
  def receive = {
    case SaveMyMessage(list) =&gt;
  
     val originalSender = sender
  
     val res : Future[\/[Throwable,String] ] = MyService.saveValues(list)
  
  
     originalSender ! res
    }
  }
  </code></pre>
  
  <p>As you can see in <code>def saveMessage</code> I am using <code>ask</code> to wait for a result from an actor. However <code>ask</code> also creates its own future so result (<code>val res</code>) in <code>saveMessage</code> becomes <code>Future[Future[T]]</code> which looks annoying. What's the best way to deal with this scenario? </p>