🚧 Attention: under construction 🚧
AssignPrivateAddressSaga.java
there is a use of QueryGateway
for validation
of the address assigment. This goes against CQRS principles stating that a Saga must not access
the read-model (or projections). See this question and answer
for more details.
Playground application with uses Axon framework to demonstrates a way of building a distributed event-driven system around the concepts of domain-driven design and CQRS.
There are several modules, they are standalone Spring Boot applications or libraries:
common
: module containing configuration (Maven dependencies) common to other modulescore
: module with all commands and events shared by other modulesdb
: H2 file database running as a TCP serveraddress
: microservice around "address" aggregateperson
: microservice around "person" aggregatesaga
: Saga implementation of a business transaction (private address assignment)
- Using Axon Server version 4.1 without event sourcing infrastructure
- Aggregates, projections, and Sagas persist their states in the separate schemas of the central H2 database
This is the overview of the system:
- http://localhost:8080/swagger-ui.html (Person)
- http://localhost:8081/swagger-ui.html (Address)
This is how assigning private address to a person Saga proceeds:
- Run
mvn package
on the project - Run
docker-compose up
- Access H2 console at http://localhost:8079/h2-console
- Use Server configuration
- JDBC URL: jdbc:h2:tcp://localhost:9090/./axondb;IFEXISTS=true;DB_CLOSE_ON_EXIT=FALSE