A real-world, event-driven microservices system that models how large e-commerce platforms process orders using Kafka, Redis, and Spring Boot. This project demonstrates how independent services communicate asynchronously to handle order creation, inventory reservation, payment processing, and customer notifications.
This project includes a lightweight interactive web UI built with Streamlit to visualize and test the entire distributed order flow in real time. The UI allows you to place orders, track them, and observe how they move through Kafka-driven microservices — without reading logs. Use the demo UI like this
| Layer | Technology |
|---|---|
| Demo Frontend | Streamlit |
| Backend | Spring Boot (Java) |
| Messaging | Apache Kafka |
| Cache / Inventory | Redis |
| Database | PostgreSQL |
| Containerization | Docker + Docker Compose |
| Serialization | JSON (Jackson) |
- Creates new orders
- Publishes
order.createdevents - Stores orders in PostgreSQL
- Consumes
order.created - Reserves stock in Redis
- Publishes
inventory.reserved
- Consumes
inventory.reserved - Simulates payment success/failure
- Publishes
payment.successorpayment.failed
- Consumes payment events
- Logs success or failure notifications
{
"orderId": "uuid",
"userId": "uuid",
"totalAmount": 500,
"items": {
"product-id-1": 2,
"product-id-2": 1
}
}All communication is event-driven — services never call each other directly.
- Running the UI
cd doms-ui
pip install -r requirements.txt
streamlit run app.py
Then open:
http://localhost:8501
- Example Flow
Enter a User ID -> Add Product IDs & Quantities -> Click Place Order -> Click Refresh Orders -> Get Order Table
- Start the system
docker compose up --build
This launches:
- Kafka
- Zookeeper
- Redis
- PostgreSQL
- All microservices
- Create an order
curl -X POST http://localhost:8081/orders \
-H "Content-Type: application/json" \
-d '{
"userId": "11111111-1111-1111-1111-111111111111",
"amount": 500,
"items": {
"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa": 2,
"bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb": 1
}
}'
- Verify the Flow
Watch logs:
docker logs distributed-order-management-inventory-service-1
docker logs distributed-order-management-payment-service-1
docker logs distributed-order-management-notification-service-1
You will see:
Inventory reserved
Payment success
Notification sent
- Event-Driven Architecture
- Saga-style workflow
- Loose coupling via Kafka
- Idempotent message handling
- Redis atomic operations
- Asynchronous fault-tolerant processing
Author: Abhash Kumar
