This project demonstrates an event-driven architecture with two Spring Boot microservices communicating via RabbitMQ.
- accounts-service — Exposes a REST API to create accounts and publishes events to RabbitMQ.
- message-service — Listens to account creation events and persists received messages to its own PostgreSQL database.
- Communication: Asynchronous messaging with RabbitMQ.
- Persistence: PostgreSQL per service (separate schemas/databases).
- Containerization: Docker & Docker Compose.
- Account creation via REST
- RabbitMQ message publishing
- RabbitMQ message consumption
- Database persistence in both services
- Isolated PostgreSQL containers for each service
Make sure Docker is installed and running.
mvn clean install
docker-compose down -v && docker-compose up --build -d
Then test the system:
curl -X POST http://localhost:8081/api/accounts \
-H "Content-Type: application/json" \
-d '{"username": "some name"}'
Check logs in message-service to see the received message and DB insert.
- Java 21
- Spring Boot 3
- Spring Web, Spring Data JPA, RabbitMQ
- PostgreSQL
- Docker, Docker Compose
MIT License