Welcome to the Axon Exhibition.
The purpose of this repository is to illustrate usage of the Axon Framework and act as a reference example for myself and others. Technologies used include:
- Spring Boot
- Spring Data JDBC
- Axon Framework
- Command Side: PostgreSQL
- Query Side: PostgreSQL
- Message Router: Axon Server
- Serializer: JSON (using Jackson)
- Java 17
- Records
- Gradle
- Multi project build
- Version catalogues
- Flyway
The application models a simple banking domain where you have accounts which can make payments to each other. There is a (somewhat nonsensical) constraint that each account needs to be associated with an email address which is unique across all accounts.
A number of convenience endpoints also exist to demonstrate a specific feature:
- Have a local postgres DB running and set up.
- Change the
application.properties
datasource properties with the correct postgres DB details. - Change the
build.gradle
flyway closure with the correct postgres DB details. - Run
./gradlew flywayClean
&&./gradlew flywayMigrate
to get the DB schema in place. - Run Axon Server.
- Run the application using
./gradlew bootRun
or using the autogenerated Spring Boot run configuration (if using IntelliJ). - Check
localhost:8080/swagger-ui.html
for the swagger UI and play around with the app.- Inspect the DB to see how everything is persisted (JSON).
- Aggregates
- Polymorphic aggregates
- Sagas
- Deadlines
- Set based validation/command side projection
- Command Handling
- Using a routing key (for a command handler not attached to an aggregate)
- Using the SimpleCommandBus
- Queries
- Configuration:
- Propagating error handler
- Simple Deadline Manager
- Unit Tests
- Integration Tests
A number of other projects were useful as references to build this project:
- Add integration tests
- Use testcontainers
- snapshot taken test
- scenarios: break account email constraint
- payment, immediate pyament, scheduled payment
- Add a subscription query
- Understand why
@QueryHandler
annotated methods cause issues with the Java module system. - Look at documentation for indexes and see how SQL compares.
- Understand and remove unnecessary tables/sequences
- Update the OpenAPI documentation to include:
- common 500 response
- respond with actual
ResponseEntity<T>
where T is a response for the endpoint. - description for all endpoints
- sorting the endpoints so that the "example demonstrations" is at the top
- Write out this README adding screenshots if need be.