Queue
Construct a queue and the full producer/admin API.
Construct a queue and the full producer/admin API.
The Queue API is split across several pages for readability:
import { Queue } from "@byteveda/flexiq";
const queue = new Queue(options);| Option | Type | Description |
|---|---|---|
dbPath | string | SQLite file path (default backend). |
backend | "sqlite" | "postgres" | "redis" | Storage backend. |
dsn | string | Connection string for postgres/redis. |
poolSize | number | Connection pool size (sqlite/postgres). |
schema | string | Postgres schema (default flexiq). |
prefix | string | Redis key prefix. |
namespace | string | Namespace applied to enqueued jobs + the worker scheduler. |
serializer | Serializer | Arg/result serializer (default JsonSerializer). |
codec | PayloadCodec | PayloadCodec[] | Global codec chain wrapping the serializer — covers every payload and result. See Serializers. |
codecs | Record<string, PayloadCodec> | Named codec registry for per-task codecs (payload only). |
| Method | Description |
|---|---|
task(name, fn, config?) | Register a task. See Task. |
configureQueue(name, config) | Set per-queue rate limit / concurrency. |
enqueue(task, args?, options?) | Enqueue a job → job id. Throws if a gate rejects or skips. |
tryEnqueue(task, args?, options?) | Enqueue a job → job id, or null when a gate skipped it. A gate that rejects still throws. |
enqueueMany(task, jobs[]) | Batch-enqueue { args?, options? }[] → job ids in input order, uniqueKey entries deduped. |
workflows — Workflow builder + queries, exposed as queue.workflows.