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 |
|---|---|---|
|
|
Stores the options and resolves the logger, leaving the broker connection to the subclass. |
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
boolean |
Whether abandoned jobs are pushed back on the way out. | |
|
|
boolean |
Whether this queue drains before shutting down. Resolved once, at construction, from JobQueueOptions.drain falling back to | |
|
|
number |
Milliseconds a drain waits before abandoning what is left. | |
|
|
(Optional) The handler registered by | ||
|
|
IMessageQueue |
The underlying | |
|
|
Set<InFlight> |
(Optional) Work this queue is waiting on, allocated only while BaseJobQueue.drains is on — with draining off there is nothing to track and nothing to allocate. | |
|
|
ILogger |
Logger this queue reports through — JobQueueOptions.logger when one was given, | |
|
|
string |
Name of this queue, as given in JobQueueOptions.name. | |
|
|
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 |
|---|---|---|
|
Destroys the job queue, closing the broker connection and releasing its resources. Not reversible — construct a new queue to carry on. | ||
|
Drain step four: release the transport. Last, because it closes the connection every step above needed. | ||
|
Drain step three: put back whatever the budget ran out on. | ||
|
Drain step one: stop consuming. The reader goes, the writer stays — which is what lets the rest of the drain publish anything at all. | ||
|
Drain step two: wait for work already in flight, bounded by JobQueueOptions.drainTimeout. | ||
|
|
Handles one popped message: runs the handler, then acts on what it asked for. | |
|
Starts processing the job queue. | ||
|
Stops processing the job queue, leaving it able to start again. | ||
|
|
Records a unit of work as in flight until it settles. |
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.