A distributed, cloud-native notification microservice built with FastAPI (Python), integrating Kafka, Redis, and MySQL, orchestrated with Docker Compose.
- Send Notifications: Asynchronous processing via Kafka.
- Status Tracking: Stores status in MySQL and Redis.
- Idempotency: Redis-based idempotency key support to prevent duplicate processing.
- Rate Limiting: Redis-based rate limiting (60 requests/minute).
- Language: Python 3.11 (FastAPI)
- Database: MySQL 8 (Async SQLAlchemy)
- Broker: Kafka (AIOKafka)
- Cache/KV: Redis 7 (Async)
- Containerization: Docker & Docker Compose
notification-service: FastAPI Application (Port 8000)mysql: Database (Port 3306)redis: Cache & Rate Limiting (Port 6379)kafka+zookeeper: Message Broker (Port 9094)
docker compose up -d --buildcurl http://localhost:8000/healthcurl -X POST "http://localhost:8000/api/notify?userId=1&msg=Hello"Response: Queued Notification ID: <id>
curl "http://localhost:8000/api/notify/status?id=<id>"for i in {1..70}; do
curl -X POST "http://localhost:8000/api/notify?userId=1&msg=Test-$i";
echo;
donecurl -X POST "http://localhost:8000/api/notify?userId=1&msg=Repeat" -H "Idempotency-Key: test-key-1"Repeating the above command should return a duplicate request error.