Build a distributed, fault-tolerant, and extensible job queue system using Go. The system must handle asynchronous background tasks like sending emails, generating reports, etc., and must support retries, prioritization, scheduling, observability, and failure handling.
- RESTful API for job submission and status tracking
- Multiple worker support with concurrency
- Retry and dead-letter queue mechanism
- Job prioritization (high, medium, low)
- Delayed job scheduling
- Monitoring via Prometheus
- Optional: Admin UI dashboard
| Component | Tech |
|---|---|
| Language | Go |
| Queueing | Redis or PostgreSQL |
| API Framework | chi/gin |
| Monitoring | Prometheus + Grafana |
| Deployment | Docker, optional K8s |
POST /submit-job
{
"type": "email",
"payload": {"email": "[email protected]"},
"priority": "high",
"delay": 30
}- Stores job in Redis (list/sorted set) or Postgres with
run_atfield
- Goroutines fetch and execute jobs
- Configurable concurrency (e.g., 5 workers)
- Exponential backoff retry mechanism
- Max retries configurable (e.g., 3)
- Moves failed jobs to
dead-letterqueue with reason
- Use separate queues for priorities:
job:high,job:medium,job:low - Workers poll high priority queues first
- Scheduled jobs stored in Redis sorted set or Postgres
run_at - Mover service polls and enqueues ready jobs to live queues
GET /job-status/:idReturns job metadata, status, retries, and result
- View active, failed, and dead-letter jobs
- Retry/Resubmit failed jobs
- Prometheus metrics:
job_processing_duration_secondsjobs_failed_totaljobs_processed_total
- Health check endpoint:
/healthz
- Multiple worker nodes supported
- Redis BLPOP or Postgres row locking to avoid duplicate processing
- User signup triggers
/submit-jobwithtype=email_welcome - Worker picks the job, sends welcome email
- On failure, retries 3 times, then moves to dead-letter
- CLI for job management (enqueue/retry/delete)
- Graceful shutdown and job requeue
- Dashboard built with Go templates or React
- Integration tests for full pipeline
Generated docs ( may be inaccurate )