BaseJobQueue class

Shared base of the three concrete queues, implementing everything that does not depend on which end of the queue you are.

Signature:

export declare abstract class BaseJobQueue<T, U> implements AnyJobQueue<T> 

Implements: AnyJobQueue<T>

Remarks

Not usable on its own and not meant to be subclassed outside this package: it leaves BaseJobQueue.imq to be assigned by a subclass constructor, so a subclass that forgets to do so fails on first use. Reach for JobQueue, JobQueueWorker or JobQueuePublisher instead.

T is the concrete queue type, so inherited methods resolve to it rather than to this base; U is the job body type.

Constructors

Constructor

Modifiers

Description

(constructor)(options)

protected

Stores the options and resolves the logger, leaving the broker connection to the subclass.

Properties

Property

Modifiers

Type

Description

handler?

protected

JobQueuePopHandler<U>

(Optional) The handler registered by onPop, if any.

imq

protected

IMessageQueue

The underlying @imqueue/core message queue this job queue runs on.

logger

readonly

ILogger

Logger this queue reports through — JobQueueOptions.logger when one was given, console otherwise.

name

readonly

string

Name of this queue, as given in JobQueueOptions.name.

options

protected

JobQueueOptions

The options this queue was constructed with, kept so that accessors like BaseJobQueue.name can read them back. Treat as read-only — nothing re-reads them after the broker connection is made, so changing one here has no effect on a running queue.

Methods

Method

Modifiers

Description

destroy()

Destroys the job queue, closing the broker connection and releasing its resources. Not reversible — construct a new queue to carry on.

start()

Starts processing the job queue.

stop()

Stops processing the job queue, leaving it able to start again.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.