Hi Greg,

You're looking for:

import akka.pattern.pipe
class FooActor() extends Actor {
 def receive = {
 case inMsg:Msg => doSomeWork(inMsg) pipeTo sender() // doSomeWork returns
Future[Seq[String]]
 }
}

I.e. you want to send the result of the Future, not the Future itself.

On Wed, Sep 24, 2014 at 7:05 PM, tigerfoot <[email protected]> wrote:

> Hello,
>
> I have a remote actor that does work in its receive block that can return
> a future.  For example:
>
> class FooActor() extends Actor {
>  def receive = {
>  case inMsg:Msg => sender ! doSomeWork(inMsg)  // doSomeWork returns
> Future[Seq[String]]
>  }
> }
>
>
> Would this work remotely?  I tried using it like this on the client side:
>
> val myActor = .... // look up a selector
> val fut = ask(myActor, Msg("hi")).mapTo[Seq[String]]
> val res = Await.result(fut, 5.seconds)
>
>
> This returns scala.concurrent.impl.Promise$DefaultPromise, which I have no
> clue what to do with.  I've also tried variants with '?' notation for the
> ask.
>
> Is there I way to stay unblocked during this whole thing, or will I have
> to Await on doSomeWork in FooActor then send the results (Seq[String])?
>
> Thanks!
> Greg
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Cheers,
√

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to