Skip to content

basalt / queue/src / SyncQueueDriver

Class: SyncQueueDriver ​

Defined in: queue/src/drivers/sync.ts:21

Synchronous driver: executes the job inline on dispatch, honoring attempts (immediate retry). It is the driver for tests and Redis-less dev — the equivalent of Laravel's sync queue driver.

Semantics to be aware of (they differ from a broker-backed driver):

  • At-most-once. A job that exhausts its inline retries is LOST — there is no persistence and no later redelivery.
  • Errors propagate to the dispatcher. job.dispatch() rejects when the handler fails (useful in tests/dev; a broker driver would return immediately and retry in the background). Deploying this driver to production is almost always a misconfiguration — queuePlugin warns when it is selected by default there.

Implements ​

Constructors ​

Constructor ​

> new SyncQueueDriver(): SyncQueueDriver

Returns ​

SyncQueueDriver

Properties ​

capabilities ​

> readonly capabilities: object

Defined in: queue/src/drivers/sync.ts:25

What this backend honors — see DriverCapabilities.

backoff ​

> backoff: boolean = false

delayed ​

> delayed: boolean = false

priority ​

> priority: boolean = false

retries ​

> retries: boolean = true

Implementation of ​

QueueDriver.capabilities


executed ​

> readonly executed: object[] = []

Defined in: queue/src/drivers/sync.ts:28

execution history — useful in test assertions

attempts ​

> attempts: number

jobName ​

> jobName: string

queue ​

> queue: string


name ​

> readonly name: "sync" = 'sync'

Defined in: queue/src/drivers/sync.ts:22

Short identifier used in diagnostics (e.g. 'bullmq', 'sync').

Implementation of ​

QueueDriver.name

Methods ​

add() ​

> add(queue, jobName, data, options): Promise<void>

Defined in: queue/src/drivers/sync.ts:34

Parameters ​

queue ​

string

jobName ​

string

data ​

unknown

options ​

AddJobOptions

Returns ​

Promise<void>

Implementation of ​

QueueDriver.add


close() ​

> close(): Promise<void>

Defined in: queue/src/drivers/sync.ts:66

Returns ​

Promise<void>

Implementation of ​

QueueDriver.close


setExecutor() ​

> setExecutor(executor): void

Defined in: queue/src/drivers/sync.ts:30

Called once by the QueueManager — how to execute a received job.

Parameters ​

executor ​

JobExecutor

Returns ​

void

Implementation of ​

QueueDriver.setExecutor


startWorker() ​

> startWorker(): void

Defined in: queue/src/drivers/sync.ts:53

Starts a worker for the queue (no-op in the sync driver: add executes inline).

Returns ​

void

Implementation of ​

QueueDriver.startWorker

Released under the MIT License.