Step 1: Requirements
Requirements
Questions to ask
- Cron-based scheduling or one-time delayed execution or both?
- How many concurrent jobs?
- Job persistence (survive restart)?
- Retry on failure? How many times, what backoff?
- Priority queue or FIFO?
- Job dependencies (job B runs after job A completes)?
- Distributed (multi-worker) or single process?
Functional requirements
- Schedule jobs for one-time or recurring execution (cron expressions)
- Job lifecycle: PENDING → RUNNING → COMPLETED | FAILED | RETRYING
- Configurable retry: max attempts, exponential backoff
- Priority levels: HIGH, NORMAL, LOW
- Cancel a scheduled/running job
- Job history with execution time, result, and error
Non-functional requirements
- Persist job queue (survive process restart)
- Concurrency limit (max N jobs running simultaneously)
- Observable: job status changes, completion events
- Extensible: new job types without modifying scheduler