-
Notifications
You must be signed in to change notification settings - Fork 35
Description
This is a design exploration of composability / orchestration patterns.
Resources as context
-
"
COMPOSABLE EVENT SOURCING WITH MONADS"
http://www.lambdadays.org/static/upload/media/1519724460390566danielkrzywickieventsourcing.pdf -
https://stackoverflow.com/questions/51160457/event-sourcing-without-cqrs
-
"
The Application of Petri Nets to Workflow Management"
http://wwwis.win.tue.nl/~wvdaalst/publications/p53.pdf
"State-based instead of event-based In contrast with many other process modeling techniques, the state of case can be modeled explicitly in a Petri net. Process modeling techniques ranging from informal techniques such as dataflow diagrams to formal techniques such as process algebra’s are event-based, i.e., transitions are modeled explicitly and the states between subsequent transitions are modeled implicitly. Today’s workflow management systems are typically event-based, i.e., tasks
are modeled explicitly and states between subsequent tasks are suppressed. The distinction between an event-based and a state-based description seems to be very subtle, but examples in this paper (e.g. Figure 16) show that this is of the utmost importance for workflow modeling. For example, in most
workflow management systems which abstract from states it is not possible to use the implicit OR-split."
Questions.
-
Are
event sourcingandCQRSwelded together inAecoror can they be used separately? -
Can
Aecorbe used to implement all use cases from "COMPOSABLE EVENT SOURCING WITH MONADS" ? (please skim through presentation to offer an initial assessment if any show stoppers exist before going deeper to prove) -
How to implement
checkpointingrolling snapshots withAecor(could be thought of related to composability). (see https://cqrs.files.wordpress.com/2010/11/cqrs_documents.pdf for definition)
In the banking app example the assumption of all account transactions being held in memory is not realistic. Thinking that if in a real implementation the transactions would be stored in another persistent repository and the aggregate would keep the transactions not yet checkpointed. If so, then these methods would need to be implemented differently
aecor/modules/example/src/main/scala/aecor/example/account/EventsourcedAlgebra.scala
Lines 42 to 46 in be6b979
| if (account.hasProcessedTransaction(transactionId)) { | |
| ().pure[F] | |
| } else { | |
| if (account.hasFunds(amount)) { | |
| append(AccountDebited(transactionId, amount)) |
If this line of thinking is agreeable with you then please share some thoughts on techniques to achieve this. Maybe to suspend the ~ rolling snapshots in a separate effect ?
update 2018/01/06 : Found "Scaling Event-Sourcing at Jet" very useful.
I have a number of real applications with non trivial such business logic it seems it would be warranted to encapsulate in separate effects (could use the other effects like Sync and MoandError for example).
Disclaimer: I know this is rough, sorry, and still working through how composition / orchestration is done in https://github.com/vpavkin/ticket-booking-aecor/blob/master/booking/src/main/scala/ru/pavkin/booking/ProcessWirings.scala (seems CQRS based).