Skip to content

Event-driven microservices demo using Spring Boot, RabbitMQ, and PostgreSQL. Asynchronous communication between services with persistent storage.

Notifications You must be signed in to change notification settings

AlekseyBykov/pets.event-driven-demo

Repository files navigation

pets.event-driven-demo

This project demonstrates an event-driven architecture with two Spring Boot microservices communicating via RabbitMQ.

Services

  • 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.

Architecture

  • Communication: Asynchronous messaging with RabbitMQ.
  • Persistence: PostgreSQL per service (separate schemas/databases).
  • Containerization: Docker & Docker Compose.

Features

  • Account creation via REST
  • RabbitMQ message publishing
  • RabbitMQ message consumption
  • Database persistence in both services
  • Isolated PostgreSQL containers for each service

How to Run

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.

Tech Stack

  • Java 21
  • Spring Boot 3
  • Spring Web, Spring Data JPA, RabbitMQ
  • PostgreSQL
  • Docker, Docker Compose

License

MIT License

About

Event-driven microservices demo using Spring Boot, RabbitMQ, and PostgreSQL. Asynchronous communication between services with persistent storage.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published