But using Akka ask is not blocking itself. Await or get is. I think you can
do sth like
context.actorOf(GetPost.props(ctx)) ? postId mapTo[ReponseType] map { *response
=> *
//here put your code
}
W dniu poniedziałek, 12 stycznia 2015 13:55:50 UTC+1 użytkownik Arnaud
Gourlay napisał:
>
> Hi HAkkers,
>
> I am currently trying to migrate a Spray application using the
> One-Actor-Per-Request pattern to Akka-Http.
>
> Following this pattern I used to delegate the completion of the current
> RequestContext to an additional actor like this
>
> path("posts" / JavaUUID) { postId ⇒ get { ctx ⇒
> context.actorOf(GetPost.props(postId, ctx)) } }
>
> This was possible as a Spray Route was a fonction HttpRequest ⇒ Unit but
> in Akka-Http, the Route definition has been changed to HttpRequest ⇒
> Future[HttpResponse].
> Therefore the previous snippet does not compile anymore.
>
> Don't get me wrong, I do think that getting rid of the Unit is a good
> thing but I currently can not see how to port this pattern to Akka-Http.
>
> Any ideas how to get around this and complete requests without Ask?
>
> Thank you!
>
> Arnaud
>
> ref :
> http://techblog.net-a-porter.com/2013/12/ask-tell-and-per-request-actors/
>
--
>>>>>>>>>> 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.