Queue == Que == Q
A basic job queue implemented in Go.
Task
is the basic unit of work that we want to run.Job
contains >= 1 relatedTask
(s).Queue
contains jobs and determines how/when to execute certainJob
s.JobQ
is just a runner that runs readyJob
s.
- Both
Queue
andTask
are interfaces that you can easily implement and provide additional fields to. PriorityQueue
is provided as a default to use withJobQ
.- It is heap-based, so it implements the methods necessary for container/heap.
Job.Priority
can be anything as long as they can be converted/encoded toint
(string, date, numbers, etc.).- Jobs must run sequentially (due to priority), but tasks in a job can run either sequentially or concurrently.
Do take a look at jobq_test.go
to see how JobQ
is used.