This repository can be started either manually or with Docker Compose.
Use Docker Compose when you want the full stack with MySQL, Kafka, Eureka, item, inventory, and order services running together.
docker compose up --buildThe exposed ports are:
8761fordiscovery-server8081foritem8082fororder8083forinventory3306for MySQL9092for Kafka
Use manual startup when you want to run the services one by one from your IDE or terminal.
- Start MySQL and create the databases
item_service,inventory_service, andorder_service. - Start Kafka and make sure it is reachable on
localhost:9092. - Start
discovery-serveron port8761. - Start
inventoryon port8083. - Start
itemon port8081. - Start
orderon port8082.
The recommended order flow is:
- A client creates an order through the
orderservice. - The order service stores the request in
PENDINGstate and emitsOrderCreated. - The order service asks
inventoryto reserve stock. - Inventory either reserves the quantity and emits
InventoryReserved, or rejects the request and emitsInventoryRejected. - If the reservation succeeds, the order service marks the order
CONFIRMEDand emitsOrderConfirmed.
- The Docker Compose setup uses environment variables so the services can also run outside containers without editing source files.
- The reservation flow is intentionally kept as a separate step so it is easy to extend with downstream consumers later.