This is the DDD reactive implementation of bank account example. The purpose of this demo is to demonstrate how to deal with data consistence in the reactive implementation using DDD (domain driven design) principles.
- DDD
- message driven architecture
- event sourcing
- CQRS
This demo is implemented using Spring reactor project.
AccountTransaction
Those two aggregate roots representing two bounded contexts Account bounded context and Transaction bounded context.
account-domain-api module contains definition of contract provided by Account aggregate.
Here is the list of basic operations:
- create account
- deposit money
- withdraw money
transaction-domain-api module contains definition of contract provided by Transaction aggregate
Here is the list of basic operations:
- create transaction
- cancel/rollback transaction
- finish transaction
- transfer money between two accounts
Implementation is following CQRS and event sourcing design pattern. Persistence API is provided by
common-persistence-api. This module provides in memory storage for:
- events generated by particular aggregate
AggregateRepositoryImpl - storage for view model
ViewRepositoryImpl
- Create two accounts
AandBwith specific amount of money - Create the transaction for transferring specific amount of money from account
Ato accountB - Transaction finished: successfully or failed
- Transaction closes and informs about result.
- Transaction closes and informs about result.
- Transaction returns money to account
A - Transaction closes and informs about result.
- If money were withdrawn from account
A-> money returns to accountA - Transaction closes and informs about cancellation.