Hi,

in the short term actor situation that you described (these are sometimes
also called per-request actors), you can send to the short term actor
something, that lets you complete the original request that arrived to the
endpoint. I do not know what you are using for handling requests, but
akka-http has completeWith
<http://doc.akka.io/docs/akka/2.4.7/scala/http/routing-dsl/directives/marshalling-directives/completeWith.html#description>
directive,
which allows you to get a function, which can be used to complete the
original request. You can send this function to your per-request actor and
complete the request from there when all of the required data returns from
the various actors. In this case you will be able to use tell when sending
original request to the per-request actor.

On Thu, Jun 23, 2016 at 12:37 AM, kraythe <kray...@gmail.com> wrote:

> Lets say I create an actor that will serve JSON to an end user but that
> actor returning the OverviewJson has to get data from three different
> actors and wait for them all to return a response before proceeding. Now I
> could create an actor that uses the ask patter to call all three other
> actors but that seems like it might be a bit heavyweight. I don't like
> using ask because of the concurrency involved. What I was wondering is if
> anyone had ideas for doing this without ask. However, at some point i have
> to return the data synchronously. After all the user is on the endpoint
> waiting for a response so I cant just message them asynchronously.
>
> One thought i had was to create a short term actor that send the messages
> to the other actors in the preStart and then waited until it collected all
> data with all three pieces collected and then returned to the user the
> created info. This seems to be exactly what the Ask pattern does and so I
> wonder if I am any better off then I would be just using Ask.
>
> Thanks for the feedback.
>
> --
> >>>>>>>>>> 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 https://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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to