I've personally implemented something similar using CQRS. In Akka that 
roughly translated to an Actor for reading data and an Actor for writing 
data (using Futures to wrap the actual repository interaction). The actual 
implementation had a bit more meat to it but the general idea was an Actor 
for each type of transaction.

I originally got the idea from a BoldRadius presentation by Mike Nash which 
can be found 

Well worth the read

On Monday, September 19, 2016 at 9:13:52 AM UTC-4, Love Hasija wrote:
> Hi,
> I am trying to create a domain driven repository using Akka. However, i am 
> confused with regard to what the ideal design should look like.
> I have domain objects like Entity and a repository needs to be created 
> with various interfaces like findByXYZ() and add().
> The requirement for individual repository operations like findByXYZ and 
> add are that these operations are multi-step and includes state in them. As 
> an example, a pseudo code for findByXYZ would be:
> - findByX
> - findByY
> - findByZ
> - Aggregate
> - Get the resulting data.
> The way i approached this, is by creating a single worker actor that 
> triggers a workflow by invoking futures for each of steps defined above and 
> invoking respective messages to itself. As all the results are obtained, 
> the results are accumulated and returned back.
> However, what I am wondering is that:
>     1) Are future compositions not enough for this, do we really need an 
> actor. The advantage I see is alternative corrective path if required.
>     2) The single actor is performing multiple types of workflows, for eg: 
> 1 for adding new record, 1 for finding. However, this is creating a big 
> actor. Can multiple actors be created for each type of command messages.
> Any help would be greatly appreciated.

>>>>>>>>>>      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