This project is a demo to understand event-driven architecture in microservices using Spring Boot, Spring Cloud Stream, and RabbitMQ.
- order-service: Handles order creation and emits events.
- notification-service: Listens for order events and sends notifications.
- discovery-service: Service registry using Eureka.
You can run RabbitMQ using Docker (with or without Docker Desktop). If you don't want Docker Desktop, you can use Colima as a lightweight Docker runtime for macOS.
brew install colima
colima startdocker run -d --hostname rabbitmq --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management- Management UI: http://localhost:15672 (user: guest, pass: guest)
- AMQP port: 5672
- Messages are not lost if your consumer service is down, as long as:
- The queue is durable
- Messages are persistent
- DLQ (Dead Letter Queue) is recommended for handling messages that cannot be processed after several attempts, but is not required for temporary consumer downtime.
- Monitor queue size and disk space if your service may be down for an extended period.
- Start RabbitMQ as above.
- Start each microservice (order, notification, discovery) using Maven or your IDE.
- Place your RabbitMQ connection settings in
application.properties:spring.rabbitmq.host=localhost spring.rabbitmq.port=5672 spring.rabbitmq.username=guest spring.rabbitmq.password=guest
- Create an order via the order-service API to see event-driven flow.
- Check what is using a port:
lsof -i :5672
- View running Docker containers:
docker ps
MIT