Skip to content

basalt / queue/src / QueueManager

Class: QueueManager ​

Defined in: queue/src/manager.ts:190

Implements ​

  • JobDispatcher

Constructors ​

Constructor ​

> new QueueManager(driver, options?): QueueManager

Defined in: queue/src/manager.ts:200

Parameters ​

driver ​

QueueDriver

options? ​

QueueManagerOptions = {}

Returns ​

QueueManager

Methods ​

close() ​

> close(): Promise<void>

Defined in: queue/src/manager.ts:311

Returns ​

Promise<void>


dispatch() ​

> dispatch<T>(job, payload, options?): Promise<void>

Defined in: queue/src/manager.ts:250

Type Parameters ​

T ​

T

Parameters ​

job ​

JobDefinition<T>

payload ​

T

options? ​

DispatchOptions = {}

Returns ​

Promise<void>

Implementation of ​

JobDispatcher.dispatch


list() ​

> list(queue?, options?): Promise<JobSummary[] | undefined>

Defined in: queue/src/manager.ts:307

Lists individual jobs on the queue — newest first, with each job's own payload already unwrapped from the dispatch envelope. Returns undefined when the driver can't list (the sync driver keeps no state; a broker that cannot read a message without consuming it deliberately omits list).

This is the supported alternative to reaching around the framework into the broker's own client, which couples the app to one backend.

A summary carries the job's payload, so it can carry personal data — treat the result as sensitive (see the queues guide).

Parameters ​

queue? ​

string = 'default'

options? ​

ListJobsOptions = {}

Returns ​

Promise<JobSummary[] | undefined>


register() ​

> register(job): this

Defined in: queue/src/manager.ts:242

Registers a job. Registering the SAME definition twice is a no-op; registering a DIFFERENT definition under a taken name throws DuplicateJobError (it used to replace the first silently).

Parameters ​

job ​

JobDefinition<unknown> | JobDefinition<never>

Returns ​

this


retryFailed() ​

> retryFailed(queue?, options?): Promise<number | undefined>

Defined in: queue/src/manager.ts:291

Re-enqueues failed jobs; returns the count, or undefined if the driver doesn't support retrying (e.g. the inline sync driver).

Parameters ​

queue? ​

string = 'default'

options? ​
limit? ​

number

Returns ​

Promise<number | undefined>


stats() ​

> stats(queue?): Promise<QueueStats | undefined>

Defined in: queue/src/manager.ts:283

Job counts per state, or undefined if the driver can't introspect.

Parameters ​

queue? ​

string = 'default'

Returns ​

Promise<QueueStats | undefined>


work() ​

> work(queue?, options?): void

Defined in: queue/src/manager.ts:278

Starts a worker for the queue. With the sync driver it is a no-op.

Parameters ​

queue? ​

string = 'default'

options? ​
concurrency? ​

number

Returns ​

void

Released under the MIT License.