Scaling beyond two aggregates #37
-
This looks like a really interesting take on functional event sourcing. I'm wondering how it'd scale when there's more state parts in the system beyond the demo of two aggregates (restaurant and restaurant menu) that are currently represented as a pair? This file https://github.com/fraktalio/fmodel-demos/blob/main/application/state-stored-system1/src/main/kotlin/com/fraktalio/fmodel/example/statestoredsystem/adapter/persistence/AggregateStateStoredRepositoryImpl.kt could get difficult to manage if it grew to be a more complex. I'm sure there's some sort of fp idea you have in mind though. Thanks for sharing the project and congrats on the version 2.0 of it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @allforabit.
Combining multiple deciders into one is convenient in a Monolith situation, in which you have an Aggregate (application layer) that is using a combined decider. My advice is to combine deciders that have some invariant/relationship (that is why you have Saga as an optional component in your aggregate). If you design it in this way, it should be much easier to distribute each of these small Deciders under independent Aggregates and deploy them separately to achieve better scalability and parallelization. To your question :) Some options you have: I hope it makes sense. Best, |
Beta Was this translation helpful? Give feedback.
Hi @allforabit.
Thank you for your feedback!
combine
is an operation/algebra onDecider
s (Views and Sagas as well) that is associative. One could compare this operation toadd
ing Numbers in math. In FP this is known as SemiGroup. BecauseDecider<Nothing, Unit, Nothing>
represents an identity it makes it aMonoid
Combining multiple deciders into one is convenient in a Monolith situation, in which you have an Aggregate (application layer) that is using a combined decider. My advice is to combine deciders that have some invariant/relationship (that is why you have Saga as an optional component in your aggregate). If you design it in this way, it should be much easier to distribute each of th…