Hi Andreas,
On 13.02.14 12:28, Andreas Berre wrote:
Hi,
This is more of a design-pattern question than a technical one:
I've been looking at the event-sourcing implementation in the Akka
persistence module as a possible replacement for our current
Akka/event-sourcing setup. In our existing framwork we're going with
the following pattern: CommandHandlers -> EventStore -> Views/Sagas.
Each individual command handler, view, or saga are implemented as an
actor.
Looking at the implementation and examples from Akka persistence it
seems to lean towards a pattern where a single actor receives
commands, validates and executes, stores resulting events to the
journal and alters internal state to reflect changes (and manages
recovery on restart). In my mind this would result in a situation
where you have one actor per aggregate managing the above functions,
which would load it with quite a lot of complexity and business logic.
You could off course delegate some of functions to other actors
yes, delegation is a good approach.
(such as using channels to dispatch events to views),
You could also use akka-persistence views
<http://doc.akka.io/docs/akka/2.3.0-RC2/scala/persistence.html#views>
which update themselves, no need to use channels here.
but you're still left with a situation where the same actor receives
commands and manages the journal.
This is necessary when you need to validate commands against the
processor's current state and must ensure that the state doesn't change
while persisting and handling derived events. This is improssible to
achieve if your command handler is a separate actor. This is described
more detailed in the documentation.
It would be interesting to learn what implementation patterns people
are following with regards to akka persistence (and if my above
assumptions are correct)?
-Andreas
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.
--
Martin Krasser
blog: http://krasserm.blogspot.com
code: http://github.com/krasserm
twitter: http://twitter.com/mrt1nz
--
Read the docs: http://akka.io/docs/
Check the FAQ: http://akka.io/faq/
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.