Design and implement a real-time notification system combining REST API with WebSockets, message queue with Redis pub/sub, and retry with exponential backoff. Include integration tests and document architectural decisions.
Requirements
- REST API to manage subscriptions and query notification history
- WebSocket server for real-time delivery with automatic reconnection
- Message queue with Redis pub/sub to decouple producers and consumers
- Retry with exponential backoff for failed deliveries (max 5 attempts)
- Integration tests covering the full flow (send → queue → delivery)
Examples
Input:
POST /api/notifications { "userId": "123", "type": "order_update", "payload": { "orderId": "456", "status": "shipped" } }
Output:
Notification queued in Redis, delivered via WebSocket to connected user, with delivery confirmation
Accepted technologies
- Node.js + Socket.io/ws
- Python + FastAPI + websockets
- Go + gorilla/websocket
- TypeScript + NestJS
- Elixir + Phoenix Channels