| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A Spring Boot microservice that accepts notification requests over HTTP, persists them in MongoDB, and processes email delivery asynchronously via RabbitMQ.
Failed messages are routed to a dead-letter queue for later inspection.
git clone <repository-url>
cd notification-service-applicationCopy the example env file and fill in your values:
cp .env.example .envRequired variables:
| Variable | Description |
|---|---|
| MONGODB_URI | MongoDB connection string (Atlas) |
| MAIL_USERNAME | Mailtrap SMTP username |
| MAIL_PASSWORD | Mailtrap SMTP password |
The app loads .env automatically via spring.config.import in application.yml. Do not commit .env — it is listed in .gitignore.
docker compose up -dRabbitMQ will be available at:
./mvnw spring-boot:runOn Windows:
mvnw.cmd spring-boot:runThe service starts on http://localhost:8080.
GET /api/healthPOST /api/notifications
Content-Type: application/json
{
"recipient": "user@example.com",
"subject": "Welcome",
"body": "Thanks for signing up!"
}Response 201 Created:
{
"id": "6a5941134a9541fd3c6b2fef",
"recipient": "user@example.com",
"subject": "Welcome",
"status": "PENDING",
"createdAt": "2026-07-16T20:37:39.148Z"
}GET /api/notifications/{id}Response 200 OK:
{
"id": "6a5941134a9541fd3c6b2fef",
"recipient": "user@example.com",
"subject": "Welcome",
"status": "SENT",
"createdAt": "2026-07-16T20:37:39.148Z"
}GET /api/ping| Status | Meaning |
|---|---|
| PENDING | Saved and queued, email not yet sent |
| SENT | Email delivered successfully |
| FAILED | Email delivery failed (see failureReason) |
Main settings live in src/main/resources/application.yml. Sensitive values are injected from .env:
spring:
mongodb:
uri: ${MONGODB_URI}
mail:
host: sandbox.smtp.mailtrap.io
port: 2525
username: ${MAIL_USERNAME}
password: ${MAIL_PASSWORD}RabbitMQ queue and exchange names are under the notification.rabbitmq prefix in application.yml.
Health and metrics endpoints are exposed at /actuator:
src/main/java/com/mogeni/notificationserviceapplication/ ├── config/ # MongoDB, RabbitMQ configuration ├── controller/ # REST endpoints ├── dto/ # Request/response objects ├── entity/ # MongoDB documents ├── exception/ # Custom exceptions ├── repository/ # Spring Data MongoDB repos └── service/ # Business logic, producer, consumer, email
./mvnw test| Back | FazBrowse Home | New Git URL |