This is part of Awesome Backend saga well described on vinisantos.dev
It's responsibility as a Microservice is resolve anything related with Orders' context of the fictional Awesome Online Store.
It exposes Rest API endpoints allowing
- Registering Orders
- Fetching registered Orders
Pre-requisites:
- Have docker or Java 15 environment set up;
- Have running Apache Kafka on localhost:9092 - the app will startup without it but it's going to have errors for executions which ends up producing a Kafka message.
This app is containerized, so if you have docker, you can create an image running something like:
docker build -t aos/orders-microservice:latest .
Then run a container for it:
docker run --network="host" --name orders-microservice -d -p 8210:8210 aos/orders-microservice:latest
Or... You can package it:
mvn clean package
Then run the jar:
java --enable-preview -jar target/orders-microservice-1.0.0.jar
The "--enable-preview" is necessary since there are Java 15 preview features in the code.
If everything is ok, you can access the swagger-ui at:
http://localhost:8110/swagger-ui/
Inspired on [this post](https://herbertograca. com/2017/11/16/explicit-architecture-01-ddd-hexagonal-onion-clean-cqrs-how-i-put-it-all-together /), where Herberto Graça put together concepts of the most popular Architecture Styles (Ports & Adapters, Onion, Clean, etc).
This microservice has interaction with an Apache Kafka instance, for integrating with another microservices in an event-driven pattern.
The messages/events flow is described well here