Re: [akka-user] Better way to use CompletableFuture in an Actor

2016-04-26 Thread Guofeng Zhang
Konrad, There is a similar case when using AbstractActorSubscriber. I have defined an actor by deriving from AbstractActorSubscriber. This actor also use WSClient to upload some data to the remote server. I guess I should not let this actor asynchronously execute its task, that might give incorr

Re: [akka-user] Better way to use CompletableFuture in an Actor

2016-04-25 Thread Guofeng Zhang
You are right, I use java. Following your instruction, I have done it well. Thanks! Guofeng On Sun, Apr 24, 2016 at 11:51 PM, Konrad Malawski < konrad.malaw...@lightbend.com> wrote: > I'm assuming you're using Java, please tell about this explicitly when > asking questions :-) > > CompletionS

Re: [akka-user] Better way to use CompletableFuture in an Actor

2016-04-24 Thread Konrad Malawski
I'm assuming you're using Java, please tell about this explicitly when asking questions :-) CompletionStage<...> futureResponse = http client calls thingy akka.pattern.PatternsCS.pipe(futureResponse, context.dispatcher).to(self()); set a flag that you're waiting or become() into such state, for a

[akka-user] Better way to use CompletableFuture in an Actor

2016-04-24 Thread Guofeng Zhang
Hi, In an actor, I use WSClient (a class from playframework) to access remote server, which returns a CompletionStage. For my case, the actor should not process next message before the response is arrived and processed by the actor. Currently I use CompletableFuture.get() to block the actor's th