Simple in-memory job queue with a REST API.
- Missing tests for handler and queue packages
- Need to create Dockerfile and docker-compose for running the service in a container
- Needs better observability: emit stats, handle tracing, more logging.
- Could use some clean up in main (possibly using wire to construct dependencies)
Run make test
Run make lint
Run go run main.go
The queue exposes a REST API that producers and consumers perform HTTP requests against in JSON. The queue supports the following operations:
Add a job to the queue. The job definition can be found below. Returns the ID of the job
Returns a job from the queue Jobs are considered available for Dequeue if the job has not been concluded and has not dequeued already
Provided an input of a job ID, finish execution on the job and consider it done
Given an input of a job ID, get information about a job tracked by the queue
A job has the following attributes as part of its public API:
The ID is assigned to a job by the queue once the job is enqueued
There are two types: TIME_CRITICAL
and NOT_TIME_CRITICAL
. Type is sent from the producer when a job is enqueued.
The Type is not considered by dequeue’s business logic.
There are 3 statuses: QUEUED
, IN_PROGRESS
, CONCLUDED
An example job returned from jobs/{job_id}
could look like:
{
"ID": 951,
"Type": "TIME_CRITICAL",
"Status": "IN_PROGRESS"
}