Well I must be missing something. Here's what I'm doing:

    case SimulatorServiceRequestHandler.AskForStatus => {

      val requester = sender

      // Create a per-request actor whose result will go to my sender

      val getStatusActor = context.actorOf(GetStatusActor.props(requester,
service))

      getStatusActor ! GetStatusActor.DoIt // Reply goes to requester

    }

I thought you were proposing

        case msg @ SimulatorServiceRequestHandler.AskForStatus => {

      // Create a per-request actor and forward the message

      val getStatusActor = context.actorOf(GetStatusActor.props(service))

      getStatusActor forward msg

    }

But then does GetStatusActor have to reply from within it's own
AskForStatus handler? If so, and other actors are involved, how does it do
that without doing another ask with pipeToSender ?

On Thu, Sep 10, 2015 at 11:09 AM, Patrik Nordwall <patrik.nordw...@gmail.com
> wrote:

> By forward I mean forward (not chained ask). ;-)
>
>
> On Thu, Sep 10, 2015 at 8:03 PM, Richard Rodseth <rrods...@gmail.com>
> wrote:
>
>> It seemed to me that forwarding implied chained asks. Not sure what you
>> mean by aggregation vs linear flow. The goal for me is to have no asks,
>> other than the one in the route definition, and that means that the one-off
>> actor can't reply from within its "DoIt" message handler.
>>
>> On Thu, Sep 10, 2015 at 9:21 AM, Heiko Seeberger <loe...@posteo.de>
>> wrote:
>>
>>> That should work, but as long as there’s no aggregation or something but
>>> just a linear flow of messages, I think forwarding is the simplest solution.
>>>
>>> Cheers
>>> Heiko
>>>
>>> --
>>>
>>> *Heiko Seeberger*
>>> Home: heikoseeberger.de
>>> Twitter: @hseeberger <https://twitter.com/hseeberger>
>>> Public key: keybase.io/hseeberger
>>>
>>> On 10 Sep 2015, at 17:02, Richard Rodseth <rrods...@gmail.com> wrote:
>>>
>>> Thanks for the response. This is somewhat encouraging. +1 to cookbook
>>> and migration docs.
>>>
>>> I'm not up to speed on Flows, so I don't know what the proposed solution
>>> would look like in a route definition.
>>> In the meantime (this is just for a new proof of concept app) I embraced
>>> the Ask in the route definition and create one-offs in response. I didn't
>>> use forwarding as Patrik mentioned. Instead the one-off has a "requester"
>>> property and after doing a bunch of tells and receives, completes the ask
>>> future by sending a response to the requester. I hope this is OK - it seems
>>> to work as a bridge between AskWorld and TellDon'tAskWorld.
>>>
>>> On Wed, Sep 9, 2015 at 3:34 AM, Akka Team <akka.offic...@gmail.com>
>>> wrote:
>>>
>>>>
>>>>
>>>> On Wed, Sep 9, 2015 at 12:27 PM, Patrik Nordwall <
>>>> patrik.nordw...@gmail.com> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Wed, Sep 9, 2015 at 12:05 PM, Akka Team <akka.offic...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, Sep 9, 2015 at 11:59 AM, Patrik Nordwall <
>>>>>> patrik.nordw...@gmail.com> wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Sep 9, 2015 at 11:17 AM, Akka Team <akka.offic...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi Richard,
>>>>>>>>
>>>>>>>> There is no easy way currently to do per-request actors (except
>>>>>>>> that everything in your handler Flow is kind of a per-request actor), 
>>>>>>>> this
>>>>>>>> is something we need to improve. I created an issue:
>>>>>>>> https://github.com/akka/akka/issues/18431
>>>>>>>>
>>>>>>>
>>>>>>> It's possible to create an actor from the mapAsync function and
>>>>>>> return the Future of an ask request to that new actor. What am I 
>>>>>>> missing?
>>>>>>> /Patrik
>>>>>>>
>>>>>>
>>>>>> Where would you create the actor? You need an ActorRefFactory for
>>>>>> that, and the only legal way from inside a stage would be then to create 
>>>>>> a
>>>>>> top-level actor, which is far from optimal.
>>>>>>
>>>>>
>>>>> I could have created a top level actor up front and let that one
>>>>> create child actors on demand. The ask would go to the top level actor 
>>>>> that
>>>>> forwards to a child. It could be a router if a single top level actor
>>>>> becomes a bottleneck.
>>>>>
>>>>
>>>> That can work, even if not trivial. Also ties the Flow to a certain
>>>> top-level actor, making it less reusable -- but it might not matter in an
>>>> Http handler anyway. I just still don't like that single bottleneck point,
>>>> router or not.
>>>>
>>>>
>>>>>
>>>>> I agree that this is a nice feature to have built-in, but I think
>>>>> there are ways that are rather alright already.
>>>>>
>>>>
>>>> If nothing else, we should make this a cookbook pattern. Btw there is
>>>> no HTTP cookbook yet.
>>>>
>>>> -Endre
>>>>
>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> -Endre
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -Endre
>>>>>>>>
>>>>>>>> On Mon, Sep 7, 2015 at 7:23 PM, Richard Rodseth <rrods...@gmail.com
>>>>>>>> > wrote:
>>>>>>>>
>>>>>>>>> I've run into the same problem. How to do per-request actors
>>>>>>>>> rather than ask pattern with Akka Http, and I'm afraid I don't 
>>>>>>>>> understand
>>>>>>>>> how handlerFlow helps. I've started a separate thread, but if either 
>>>>>>>>> of you
>>>>>>>>> can elaborate that would be great. The Spray migration page is still 
>>>>>>>>> marked
>>>>>>>>> TODO.
>>>>>>>>>
>>>>>>>>> Thanks.
>>>>>>>>>
>>>>>>>>> On Tue, Jun 16, 2015 at 7:00 PM, Nicolau Werneck <
>>>>>>>>> nwern...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> Great, thanks for the reply!    ++nic
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Tuesday, June 16, 2015 at 5:40:55 AM UTC-3, Richard Bradley
>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> You can see the source code to the net-a-porter Spray example
>>>>>>>>>>> here:
>>>>>>>>>>>
>>>>>>>>>>> https://github.com/NET-A-PORTER/spray-actor-per-request/blob/master/src/main/scala/com/netaporter/Boot.scala
>>>>>>>>>>>
>>>>>>>>>>> The startup looks like:
>>>>>>>>>>>   IO(Http) ! Http.Bind(serviceActor, "localhost", port = 38080)
>>>>>>>>>>>
>>>>>>>>>>> where "serviceActor" is an actor that mixes in
>>>>>>>>>>> spray.routing.HttpService, as you say. The actor uses that trait to 
>>>>>>>>>>> call
>>>>>>>>>>> "runRoute" to bind its Route to the HTTP layer.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> In Akka HTTP, you instead need to wrap a Route with
>>>>>>>>>>> "akka.http.scaladsl.server.Route.handlerFlow" to turn it into a
>>>>>>>>>>> Flow[HttpRequest, HttpResponse, Unit] and then pass that into
>>>>>>>>>>> "Http().bindAndHandle(...)".
>>>>>>>>>>> See
>>>>>>>>>>> http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-M5/scala/http/server.html
>>>>>>>>>>> for more on the new API.
>>>>>>>>>>>
>>>>>>>>>>> That part has changed quite a bit, but from the Routing layer on
>>>>>>>>>>> down, everything is very much the same, in my opinion.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Tuesday, June 16, 2015 at 4:41:54 AM UTC+1, Nicolau Werneck
>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> All right then, except I'm under the impression that to use
>>>>>>>>>>>> that pattern we need to create an application using the
>>>>>>>>>>>> `spray.routing.HttpService` class, and I could not find it in 
>>>>>>>>>>>> akka-http. Is
>>>>>>>>>>>> it available under a different name?
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>     ++nic
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Monday, June 15, 2015 at 3:51:27 PM UTC-3, Richard Bradley
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> The situation is very much the same in Akka HTTP as it was in
>>>>>>>>>>>>> Spray 1.3.
>>>>>>>>>>>>> You should be able to translate the actor-per-request pattern
>>>>>>>>>>>>> into Akka with only superficial changes.
>>>>>>>>>>>>> If you didn't deal with large (streamed / chunked) requests,
>>>>>>>>>>>>> everything is very much the same from Routing on down.
>>>>>>>>>>>>>
>>>>>>>>>>>>> As to which is recommended -- I think that is much the same as
>>>>>>>>>>>>> well:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Actor-per-request needs more book-keeping (to avoid leaks) but
>>>>>>>>>>>>> allows greater control in complex scenarios.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Future calls (which can include "asks" on Actors) are simpler
>>>>>>>>>>>>> and usually more type-safe and easier to work with IMO. You need 
>>>>>>>>>>>>> to be very
>>>>>>>>>>>>> careful around mutable state though.
>>>>>>>>>>>>>
>>>>>>>>>>>>> HTH,
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Rich
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Monday, June 15, 2015 at 4:50:54 AM UTC+1, Nicolau Werneck
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> From what I gathered from the documentation and examples, the
>>>>>>>>>>>>>> usual way to answer to a request asynchronously in Spray and 
>>>>>>>>>>>>>> akka-http is
>>>>>>>>>>>>>> to `complete` with a `Future`, which may be produced from asking 
>>>>>>>>>>>>>> an actor.
>>>>>>>>>>>>>> But in Spray there was also the so-called "actor per-request" 
>>>>>>>>>>>>>> pattern,
>>>>>>>>>>>>>> documented in
>>>>>>>>>>>>>> http://techblog.net-a-porter.com/2013/12/ask-tell-and-per-request-actors/
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Is that still possible to do with akka-http? And is it
>>>>>>>>>>>>>> discouraged in general? Should we really stick to using Futures 
>>>>>>>>>>>>>> to
>>>>>>>>>>>>>> integrate akka-http to the rest of our applications?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>     ++nic
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>>>>>>>>>> To post to this group, send email to akka-user@googlegroups.com.
>>>>>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>>>>>>>>> To post to this group, send email to akka-user@googlegroups.com.
>>>>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Akka Team
>>>>>>>> Typesafe - Reactive apps on the JVM
>>>>>>>> Blog: letitcrash.com
>>>>>>>> Twitter: @akkateam
>>>>>>>>
>>>>>>>> --
>>>>>>>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>>>>>>>> To post to this group, send email to akka-user@googlegroups.com.
>>>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Patrik Nordwall
>>>>>>> Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
>>>>>>> Twitter: @patriknw
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>>>>>>> To post to this group, send email to akka-user@googlegroups.com.
>>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Akka Team
>>>>>> Typesafe - Reactive apps on the JVM
>>>>>> Blog: letitcrash.com
>>>>>> Twitter: @akkateam
>>>>>>
>>>>>> --
>>>>>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>>>>>> To post to this group, send email to akka-user@googlegroups.com.
>>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Patrik Nordwall
>>>>> Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
>>>>> Twitter: @patriknw
>>>>>
>>>>>
>>>>> --
>>>>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to akka-user@googlegroups.com.
>>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Akka Team
>>>> Typesafe - Reactive apps on the JVM
>>>> Blog: letitcrash.com
>>>> Twitter: @akkateam
>>>>
>>>> --
>>>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to akka-user@googlegroups.com.
>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>> --
>>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>>> To post to this group, send email to akka-user@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>> --
>>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>>> To post to this group, send email to akka-user@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
>> To post to this group, send email to akka-user@googlegroups.com.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> Patrik Nordwall
> Typesafe <http://typesafe.com/> -  Reactive apps on the JVM
> Twitter: @patriknw
>
> --
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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