One thing I've done to preserve layering (and I'm new to this so take it
with a grain of salt) is the following:

Per-request request handler actor sends a command to a service actor (not
per-request), including a requestor reference (self) in the message.
Service actor is free to pass the requestor to subsidiary actors, but
ultimately the "contract" is that the command response goes to the
requestor (the per-request actor), whether it does so directly or passing
back through the service actor.
In some cases, the per-request request handler actor might create children
(eg. an "accumulator") to pass to the service actor with the command,
because I don't believe there's a way to create children of the request
handler from outside of it.

I'm interested in other approaches, but this allows me to have the service
actor as the root of a tree, and as the one actor that the per-request
request handler knows about.


On Thu, Oct 9, 2014 at 7:33 AM, Martynas Mickevičius <
martynas.mickevic...@typesafe.com> wrote:

> Ahh, Richard beat me to it. :)
>
> On Thu, Oct 9, 2014 at 5:33 PM, Martynas Mickevičius <
> martynas.mickevic...@typesafe.com> wrote:
>
>> Hello Prakhyat,
>>
>> have you seen this article
>> <http://techblog.net-a-porter.com/2013/12/ask-tell-and-per-request-actors/>
>> which discusses ask vs tell patterns?
>>
>> I assume from the other thread, that you are using Java. To sum up the
>> mentioned article, if you use Play framework for handling REST calls, you
>> could return a Future from the controller. That future would be fulfilled
>> by the promise in the per-request actor.
>>
>> On Thu, Oct 9, 2014 at 9:57 AM, Prakhyat Mallikarjun <
>> prakhyat...@gmail.com> wrote:
>>
>>> Team,
>>>
>>> We are working on a simple POC. The POC is developed on the approach
>>> event sourcing/DDD/CQRS.
>>>
>>> The PersistentActors are shaded. PersistentViews are created to push
>>> events from write side towards query side.
>>>
>>> The business logic resides in PersistentActors. The rest API's are
>>> written to invoke PersistentActors. The rest layer invokes PersistentActor
>>> and waits for response. This looks like synchronous, we are using Ask
>>> pattern. The rest layer has to wait till the PersistentActor is done
>>> with business logic and returns.
>>>
>>> The ask pattern comes with a cost i.e. to specify timeout while making a
>>> call to other actor. If the response is not received within timeout
>>> specified, exception will be raised.
>>>
>>> Tell in other perspective is asynchronous. The actor making a "tell"
>>> call need not wait for response.
>>>
>>> What are your recommendations/insights on using tell vs ask?
>>>
>>> -Prakhyat M M
>>>
>>>
>>>
>>>  --
>>> >>>>>>>>>> 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.
>>>
>>
>>
>>
>> --
>> Martynas Mickevičius
>> Typesafe <http://typesafe.com/> – Reactive
>> <http://www.reactivemanifesto.org/> Apps on the JVM
>>
>
>
>
> --
> Martynas Mickevičius
> Typesafe <http://typesafe.com/> – Reactive
> <http://www.reactivemanifesto.org/> Apps on the JVM
>
> --
> >>>>>>>>>> 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