FIFO job queue backed by a pluggable Core.JobStore.
Each JobQueue is a GenServer that maintains an in-memory queue of job IDs
and a map of job structs. Jobs are persisted via the store so they survive
VM restarts (when using a durable backend such as Core.JobStore.SQLite).
Named queues
You can start multiple isolated queues by giving each a unique :name:
{Core.Workers.JobQueue, name: MyApp.EmailQueue, pool: MyApp.EmailPool}
{Core.Workers.JobQueue, name: MyApp.MediaQueue, pool: MyApp.MediaPool}All public functions accept a server reference (atom or pid) as the first
argument. The zero-arity versions operate on the default queue
Core.Workers.JobQueue.
Options
:name– registered name for this queue (default:Core.Workers.JobQueue):pool– theWorkerPoolname to notify when new jobs arrive:store–Core.JobStoremodule (default:Core.JobStore.Memory):store_opts– options passed to the store'sinit/1:cleanup_interval_ms– how often to purge old jobs (default: 1 hour):max_age_days– retention for completed / failed jobs (default: 7)
Worker notification
When a job is submitted (or a retry is scheduled), JobQueue calls
notify_workers/1 which sends :work_available to every worker process
under the configured WorkerPool. Workers use this as an immediate
wake-up signal in addition to their fallback polling timer.
Summary
Functions
Get all jobs in the queue
Returns a specification to start this module under a supervisor.
Claim the next available job for processing. Marks it as :running and returns it to the worker.
Get a specific job by ID
Mark a job as completed with a result
Mark a job as failed with an error reason
Reset the queue — clears all in-memory state. Intended for test use only.
Submit a new job to the queue. Returns synchronously with the assigned job id.
Submit a job to run at a specific future time.
The job is persisted immediately but enters the in-memory queue only at run_at.
Functions
Get all jobs in the queue
Returns a specification to start this module under a supervisor.
See Supervisor.
Claim the next available job for processing. Marks it as :running and returns it to the worker.
Get a specific job by ID
Mark a job as completed with a result
Mark a job as failed with an error reason
Reset the queue — clears all in-memory state. Intended for test use only.
Submit a new job to the queue. Returns synchronously with the assigned job id.
Submit a job to run at a specific future time.
The job is persisted immediately but enters the in-memory queue only at run_at.