Please check the TechStack.md file for details.
This is an example project to to offer you a very simple example of a CQRS architecture.
This project is also the official support project of my article on medium:
Please have a look at my Issues file to find out about improvements being made. This file contains a list of ongoing issues that on one hand do not block the development, but on the other hand they are a great nice to haves.
- 1.0.0 - 10271cee0b49da1cb80bdcd115851de94f928774 - Java
- 2.0.0 - 98eb81756c02d63d03c19e8ae87fc8023d513e0a - Java
- 3.0.0 - 696472601c04a6a26c01e83fcf464eafee4305f4 - Java
- 3.0.1 - 022a709a1fe65b57c89c68974d6577d029039eb2 - Java / Refactoring Maven (Known working dependencies)
- 3.0.2 - 3a922f4a64c6602566b3c81f4811c40cc2c119e0 - Java / Spring Boot 2.6.14 Update
- 3.0.3 - 9f53922e9be7e1a110ac9059a556a9a9571a1921 - Java / Spring Boot 2.7.6 Update, JDK19 and mono module converted to Kotlin
- 3.0.4 - ba5104f6593b7e8001f5302904b0a5f14a5697c4 - Java / Spring Boot 3.0.2 Update
- 4.0.0 - 15f2abfa5e17dc881e66b2761f5a2672fd87005a - Full Kotlin 1.8.0 / JDK19
- List all
curl localhost:8090/video-series
- Create new records
curl -d '{ "name":"True Blood", "volumes":30, "cashValue": 1323.2, "genre": "DRAMA"}' -H "Content-Type: application/json" -X POST http://localhost:8080/video-series
You can also test this application using swagger.
Just run:
make build-docker dcup
And then finally access the API you wish to test:
Example payload for Command API:
{
"name": "True Blood",
"volumes": 30,
"cashValue": 1323.2,
"genre": "DRAMA"
}
The best way to start this application is using the provided docker-composer configuration:
make build-docker
or
docker-composer up
or
docker composer up
There are many further options in the Makefile. Please explore them to find the one that suits you best.
In some cases you'll find that there will be a bin folder in the root.
Namely, this will happen when running make build-databases
or make local
.
This is where the jars of each application will go to. You can run them accordingly like this:
java -jar -Dspring.profiles.active=local video-series-command.jar
java -jar -Dspring.profiles.active=local video-series-query.jar
Should there be any resource consumption issues running the containers you can try to run:
make stop
This will attempt to stop all running mongodb
and postgres
containers, all video-series-app
containers and all
containers in the docker-compose
file.
build
- Builds all java bytecodetest
- Runs the local tests (they take long in this project)local
- Makes a build without tests and places all jars in a /bin folderno-test
- Makes a build without testsdocker
- Starts docker composedocker-databases
- Starts the database containers (Postgres + MongoDB) - You then need to start the SpringBoot/jars manuallydocker-mongo
- Only starts the mongodb container - This is meant to be tested with the default profile ONLY. It uses an embedded H2 database instead of Postgres.build-images
- Builds the images to run the spring boot processes:video-series-command
andvideo-series-query
build-docker
- Makes a clean build, stops containers and relaunches docker-compose.stop
- Makes a full stop of known containers. It is reused in many of the other commands.
- Default - No need to mention the profile in the command line, and it needs MongoDB only. Data is stored in an
embedded
H2
- local - Specified with
-Dspring.profiles.active=local
. Needs Postgres and MongoDb.localhost
is the common host locally - prod - Named after
Production
and runs with-Dspring.profiles.active=prod
. Only used in docker-compose networks
docker system prune --all
sudo lsof -i :5432
Follow the updates on the ReviewLogs file.
git checkout 1.0.0
git checkout 2.0.0
- Working with Postgres Audit Triggers
- Apply simplified CQRS and DDD patterns in a microservice
- Platforms JVM Records
- Mongo Axon Reference Guide
- CQRS Microservice Sampler by Ben Wilcock on GitHub
- Patrick Gillespie's Text to Ascii Art Generator
- Microservices With Spring Boot, Axon CQRS/ES, and Docker by Ben Wilcock
- Advanced Message Queuing Protocol
- Install MongoDB on Mac OS
- Object-Oriented Software Construction by Bertrand Meyer
- CQRS Journey by Microsoft