Recently I’m trying to develop a payment service with Axon Framework, but I’m a little bit confused when it comes to domain modelling.
The service has a simple one-to-many relationship: merchant -> transactions, so I have three options to model them in my mind so far:
- a single root aggregater - merchant, and clearly this way has a high write ratio because a merchant won’t change a lot once created but transactions will keep coming;
- two root aggregaters: one for merchant, one for transaction. Personally speaking I prefer this way than others, but the creation of transaction requires some data from merchant, so either it comes from an extra read-only data source or the merchant aggregater which can be tricky because a version number must be specified for EventSourcingRepository to load the correct merchant;
- using saga, but it seems to overkill for such simple requirement…
I’m not so familiar with CQRS and Axon Framework as well, so any suggestion is welcome, thanks.