Skip to content

Latest commit

 

History

History
85 lines (68 loc) · 3.14 KB

README.md

File metadata and controls

85 lines (68 loc) · 3.14 KB

WARNING: This repository is currently a work in progress (see TODO section for what remains)

Axon Exhibition

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

Domain

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.

Account and Payment Endpoints

A number of convenience endpoints also exist to demonstrate a specific feature:

Example Demonstration Endpoints

Usage

  1. Have a local postgres DB running and set up.
  2. Change the application.properties datasource properties with the correct postgres DB details.
  3. Change the build.gradle flyway closure with the correct postgres DB details.
  4. Run ./gradlew flywayClean && ./gradlew flywayMigrate to get the DB schema in place.
  5. Run Axon Server.
  6. Run the application using ./gradlew bootRun or using the autogenerated Spring Boot run configuration (if using IntelliJ).
  7. 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).

Feature Exhibition

  • 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

Reference Resources

A number of other projects were useful as references to build this project:

TODO

  • 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.