I ended up breaking down and doing an ask (to a request handler actor) in the route definition. The request handler creates a per-request actor with the requestor as a constructor parameter, and from then on I use no more asks, but pass replyTo in tell messages. So there is not a chain of asks, just one at the perimeter.
This does mean that the request handler is a bottleneck of sorts. See https://groups.google.com/d/topic/akka-user/-VF0ZeIt054/discussion On Tue, Nov 17, 2015 at 4:26 AM, Rafał Kowalski <[email protected]> wrote: > Hi hakkers, > > I'm struggling with the same issue trying to port the spray code in > https://github.com/NET-A-PORTER/spray-actor-per-request to akka http. It > seems that the perRequest method in the PerRequest trait should return a > Future[RouteResult] which will be completed in the newly created > actor. Is the direction of my thinking correct? If so how to achieve > that? (see stackoverflow comments: > > http://stackoverflow.com/questions/33495049/actor-per-request-in-akka-http-how-to-integrate-it-with-route-directives > ) > > BTW, maybe somebody has an akka http version of this template/example > already? > > PS: Is my understanding correct that it is still a valid recommendation > not to use the "ask pattern" but rather the fire-and-forget with per > request actors for highly scalable Akka system? > > cheers > -- > -rafał > > -- > >>>>>>>>>> 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. > -- >>>>>>>>>> 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.
