Thanks. So I guess you're basically using a persistent actor as a durable
queue, in place of something like a Kafka topic, and a single message on
the queue can include ids of multiple aggregates.

On Sat, May 9, 2015 at 10:51 AM, Olger Warnier <ol...@spectare.nl> wrote:

> Hi Richard,
>
> I use the akka cluster sharding mechanism to start instances of a
> PersistentActor.
> This actor stands for a single instance of an AggregateRoot (DDD concept)
> This specific instance contains the logic required to run.
>
> For instance this can be a UserAccount instance of a user called ‘foo’ and
> changing the password will be handled by UserAccount and applied to this
> specific instance as the user ‘foo’ wants to change its password.
> Another user called ‘bar’ will have its own instance of this
> PersistentActor running somewhere in the cluster.
>
> Let’s assume that the usernames are the unique identifiers for these
> persistent actors. (persistenceIds)
> Replaying to the state for a specific instance (for instance ‘foo’) is
> done by creating a view with the persistenceId ‘foo’)
>
> As the PersistenceActors make use of the persistenceId that is the ‘key’
> for that specific instance, it is hard to tell what the persistenceId for
> your view needs to be.
> Somebody registers the user ‘noname’ -> a persistent actor is created via
> cluster sharding with the persistenceID ‘noname’. as that is all async in
> nature, you need a way to know that this persistent actor is created (or
> received a change for that matter, as actors may be put to sleep)
>
> So, I have a singleton persistent actor that keeps track of changes with a
> ‘known’ persistenceId. When change happens to ‘foo’, ‘bar’ and ‘noname’,
> they will notify the PersistentActor with an id as
> ‘user-account-change-tracker’ that will write something like
> UserAccountChanged(‘noname’)
> A view that listens to ‘user-account-change-tracker’ will thereafter
> create the views for the specific user (for this matter ‘noname’) and
> replay / restore the state for that view as required. (mostly elasticsearch
> indexes that are used for the query side of my application)
>
> As the other approaches, this has advantages and drawbacks.
> 1) the use of cluster sharding is something you may not need (but if you
> do, persistence and cluster sharding work well together)
> 2) the event store is filled with ‘change’ events in order to trigger the
> real views to materialise
> 3) it is not dependent on a specific event store backend and therefore
> easier to include in your unit tests using the components available with
> akka-persistence
>
> With the other options, choices enough. Apply them as you require.
>
> Kind regards,
>
> Olger
>
>
>
>
>
>
> On Fri, May 8, 2015 at 10:58 PM, Richard Rodseth <rrods...@gmail.com>
> wrote:
>
>> Hi Olger
>>
>> Could you please elaborate a bit on your appoach? I'm not sure I follow.
>>
>> Thanks.
>>
>> On Fri, May 8, 2015 at 4:17 AM, Olger Warnier <ol...@spectare.nl> wrote:
>>
>>> Hi Alejandro,
>>>
>>> You have a number of options
>>>
>>> - when you have a single persistence Id, write a view for that
>>> - when you want to aggregate events of several persistence ids, you can
>>> do so via the event store (approach of Martin (with Kafka) and Greg (event
>>> store) )
>>>  Or you can aggregate the changes to a message queue and read that
>>>  Or you can aggregate via another persistent actor that publishes the
>>> fact that something has changed for a specific other persistence id and
>>> start a view for that id (my approach)
>>>
>>> And there may be other ways to solve this of course.
>>>
>>> Kind regards,
>>>
>>> Olger
>>>
>>>
>>>
>>> On Fri, May 8, 2015 at 1:07 PM, Alejandro López <ale64...@gmail.com>
>>> wrote:
>>>
>>>>  Right now, what would be the best alternative in order to create
>>>> projections, allowing views to subscribe to arbitrary events as described
>>>> by Roland above? (or at least a coarse approximation)
>>>>
>>>> --
>>>> >>>>>>>>>> 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 a topic in the
>>>> Google Groups "Akka User List" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/akka-user/MNDc9cVG1To/unsubscribe.
>>>> To unsubscribe from this group and all its topics, 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.
>>>
>>
>>  --
>> >>>>>>>>>> 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 a topic in the
>> Google Groups "Akka User List" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/akka-user/MNDc9cVG1To/unsubscribe.
>> To unsubscribe from this group and all its topics, 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.
>

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