--
>>>>>>>>>> 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+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
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
Patrik Nordwall
Typesafe - Reactive apps on the JVM
Twitter: @patriknw
On Wed, Sep 9, 2015 at 11:17 AM, Akka Team <akka.o...@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/18431It'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
On Wed, Sep 9, 2015 at 11:59 AM, Patrik Nordwall <patrik....@gmail.com> wrote:On Wed, Sep 9, 2015 at 11:17 AM, Akka Team <akka.o...@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/18431It'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?/PatrikWhere 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.
On Wed, Sep 9, 2015 at 12:05 PM, Akka Team <akka.o...@gmail.com> wrote:On Wed, Sep 9, 2015 at 11:59 AM, Patrik Nordwall <patrik....@gmail.com> wrote:On Wed, Sep 9, 2015 at 11:17 AM, Akka Team <akka.o...@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/18431It'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?/PatrikWhere 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.
I agree that this is a nice feature to have built-in, but I think there are ways that are rather alright already.
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
}
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 ?
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 proposingcase 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 ?