
Open SourcePersonal Project
NOTIFICATION API
Event-driven notification service
An event-driven, asynchronous notification processing system built with Spring Boot, PostgreSQL, and Docker. Designed to decouple notification delivery from the services that trigger it — the calling service returns instantly, and failures don't cascade.
Features
- Asynchronous notification processing using RabbitMQ
- Supports multiple channels: Email, SMS, Push notifications
- Retry mechanism with configurable attempts
- Dead Letter Queue (DLQ) for failed messages
- Persistent storage using PostgreSQL
- Clean architecture with service separation
- Strategy pattern for channel-based processing
- Structured logging instead of
System.out.println - Fully containerized with Docker & Docker Compose
System Architecture
Client Request
↓
Spring Boot REST API
↓
PostgreSQL (store notification)
↓
RabbitMQ (message queue)
↓
Consumer Service
↓
Channel Processor (Email / SMS / Push)
↓
Success → Update DB
Failure → Retry Queue → (max retries)
↓
DLQTech Stack
- Java 21+
- Spring Boot · Spring Data JPA
- RabbitMQ
- PostgreSQL
- Docker & Docker Compose
- Maven
How It Works
- A request is sent to the API to create a notification
- The notification is stored in PostgreSQL
- A message is published to RabbitMQ
- Consumer picks up the message
- Based on channel type:
EMAIL→ EmailProcessorSMS→ SMSProcessorPUSH→ PushProcessor
- If processing fails: retry up to 3 times, then send to Dead Letter Queue (DLQ)
API Usage
Create Notification
POST /notificationsRequest Body:
{
"userId": 123,
"channel": "EMAIL",
"message": "Hello, this is a test notification",
"priority": "HIGH"
}Response:
{
"notificationId": "60e9af48-ac2e-4903-bbac-1d8eff55c39d",
"status": "QUEUED"
}Running the Project
# Build the project
./mvnw clean package
# Start everything (App + RabbitMQ + PostgreSQL)
docker compose up --buildMonitoring
- RabbitMQ UI: http://localhost:15672 (guest / guest)
- Spring Boot API: http://localhost:8080
Key Design Patterns
- Strategy Pattern → Channel-based processors (Email/SMS/Push)
- Factory Pattern → Selecting correct processor
- Consumer-Producer Pattern → RabbitMQ messaging
- Retry Pattern → Fault tolerance handling
More Views
Click any image to view full size.
