Enterprise-grade distributed job processing platform built with Java 21, Spring Boot 3, PostgreSQL, Redis, and Docker.
Client → API Service → PostgreSQL (metadata) + Redis (queue)
↓
Worker Service(s) → Job Handlers
↓
Dead Letter Queue + Monitoring
- API Service (
jobqueue-api) — REST API for job management, auth, stats. Never executes jobs. - Worker Service (
jobqueue-worker) — Consumes from Redis Streams, executes jobs, handles retries/DLQ. - PostgreSQL — Job metadata, users, workers, attempt history.
- Redis — Main queue (Streams), priority queue (Sorted Sets), delayed jobs, rate limiting, DLQ.
| Feature | Implementation |
|---|---|
| Authentication | JWT + RBAC (USER, ADMIN) |
| Job Queue | Redis Streams + Sorted Sets |
| Priority | HIGH(1) → MEDIUM(5) → LOW(10) |
| Scheduling | Redis Sorted Set with score = timestamp |
| Retries | Exponential backoff: baseDelay × 2^attempt |
| Dead Letter Queue | PostgreSQL + Redis Stream |
| Idempotency | Idempotency-Key header + unique DB constraint |
| Rate Limiting | Redis token bucket per job type |
| Worker Heartbeat | Every 5s, inactive after 30s |
| Crash Recovery | RUNNING jobs > 10 min → retry |
| Monitoring | Prometheus + Grafana |
| Real-time Updates | WebSocket /ws/jobs |
| API Docs | Swagger UI at /swagger-ui.html |
SEND_EMAILGENERATE_REPORTRESIZE_IMAGEWEBHOOK_DELIVERYDATA_CLEANUP
- Java 21
- Maven 3.9+
- Docker & Docker Compose
docker-compose up -dServices:
| Service | URL |
|---|---|
| Frontend UI | http://localhost:3002 |
| API | http://localhost:8080 |
| Swagger UI | http://localhost:8080/swagger-ui.html |
| Prometheus | http://localhost:9090 |
| Grafana | http://localhost:3001 (admin/admin) |
cd jobqueue-frontend
npm install
npm run devOpens at http://localhost:3002 with API proxied to http://localhost:8080.
Start PostgreSQL and Redis, then:
# Terminal 1 — API
mvn spring-boot:run -pl jobqueue-api
# Terminal 2 — Worker
mvn spring-boot:run -pl jobqueue-worker -Dspring-boot.run.arguments=--worker.name=worker-1Email: admin@jobqueue.com
Password: admin123
# Register
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","password":"password123"}'
# Login
curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"admin@jobqueue.com","password":"admin123"}'curl -X POST http://localhost:8080/api/jobs \
-H "Authorization: Bearer <TOKEN>" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: unique-key-123" \
-d '{
"type": "SEND_EMAIL",
"priority": "HIGH",
"payload": {"to": "user@example.com", "subject": "Hello"}
}'curl http://localhost:8080/api/stats \
-H "Authorization: Bearer <ADMIN_TOKEN>"# List DLQ
curl http://localhost:8080/api/dlq \
-H "Authorization: Bearer <ADMIN_TOKEN>"
# Replay a DLQ job
curl -X POST http://localhost:8080/api/dlq/{id}/replay \
-H "Authorization: Bearer <ADMIN_TOKEN>"jobqueue-parent/
├── jobqueue-common/ # Shared entities, DTOs, enums, utilities
├── jobqueue-api/ # REST API service (port 8080)
├── jobqueue-worker/ # Worker service (port 8081)
├── jobqueue-frontend/ # React dashboard (port 3002)
├── docker-compose.yml
├── prometheus/
└── grafana/
# Unit tests
mvn test
# Integration tests (requires Docker for Testcontainers)
mvn verify -pl jobqueue-apiPENDING → QUEUED → RUNNING → COMPLETED
↓
FAILED → RETRYING → RUNNING → ...
↓
DEAD_LETTERED
- Built a distributed job processing platform using Java, Spring Boot, PostgreSQL, Redis, and Docker
- Designed async queue architecture with priority scheduling, retries, dead-letter queues, and delayed jobs
- Implemented worker heartbeat, crash recovery, idempotency, JWT auth, and rate limiting
- Added observability with Prometheus, Grafana, structured JSON logging, and WebSocket real-time updates
- Scalable multi-worker architecture capable of handling thousands of concurrent jobs
MIT
Host the API, worker, frontend, PostgreSQL, and Redis on Render using the included blueprint:
# render.yaml defines all services — apply via Render Dashboard → New → BlueprintSee RENDER_DEPLOY.md for step-by-step instructions.