IMQOptions interface

Options accepted by every queue implementation.

Anything omitted falls back to DEFAULT_IMQ_OPTIONSlocalhost:6379, prefix imq, cleanup off, safe delivery off, gzip off, a 5000 ms watcher check and safe-delivery TTL, and signal handling on.

Signature:

export interface IMQOptions extends Partial<IMessageQueueConnection> 

Extends: Partial<IMessageQueueConnection>

Remarks

Only cleanup and cleanupFilter are required by the type, even though every constructor and IMQ.create() accepts a Partial<IMQOptions> — prefer Partial<IMQOptions> when declaring option literals.

The inherited id is meaningful only on IMQOptions.cluster entries; the queue itself never reads it.

Properties

Property

Modifiers

Type

Description

cleanup

boolean

Turns on/off the watcher's periodic removal of orphaned keys.

cleanupFilter

string

Redis glob pattern, appended to the prefix as <prefix>:<cleanupFilter>, selecting which keys the cleanup sweep considers. The default matches every key in the namespace.

cluster?

IMessageQueueConnection[]

(Optional) Redis servers to spread this queue across. Supplying this — or IMQOptions.clusterManagers — makes IMQ.create() return a ClusteredRedisQueue.

clusterManagers?

ClusterManager[]

(Optional) Cluster managers that discover and maintain cluster servers dynamically. Supplying this — or IMQOptions.cluster — makes IMQ.create() return a ClusteredRedisQueue.

handleSignals?

boolean

(Optional) Enable process signal handling (SIGTERM, SIGINT, SIGABRT) by the queue. When enabled, the queue releases its watcher lock on these signals and then exits the process. It does not wait for in-flight message handlers to finish, so drain those yourself if work in progress must not be lost. Disable if the host application manages shutdown.

logger?

ILogger

(Optional) Logger used for queue diagnostics.

prefix?

string

(Optional) Global key namespace for everything this queue writes.

safeDelivery?

boolean

(Optional) Enable guaranteed message delivery. When enabled, reading a message moves it atomically out of the queue into a worker-owned key instead of popping it outright, so a worker that dies before it even starts on a message leaves that message behind for the watcher to re-queue rather than taking it down with the process.

The guarantee covers the processing too, not only the hand-off: the worker key is held until the message listener has finished with the message, which for a listener returning a promise means until that promise settles. A worker killed at any point before then leaves the message behind to be re-queued.

A message comes back on either of two counts. The owning process leaving the broker's client list catches it dying — a fact the broker holds rather than an inference from a clock, so it is noticed as fast as the socket closes and nothing has to be renewed to keep a live lease alive. IMQOptions.safeDeliveryTtl catches what liveness cannot see: one handler wedged inside a worker that is otherwise up and serving.

Delivery is at-least-once in either mode, so handlers should be idempotent: this narrows the window in which in-flight work is lost, it does not close it.

safeDeliveryTtl?

number

(Optional) The longest (in milliseconds) a message may be worked on before it is treated as abandoned and moved back onto the queue.

useGzip?

boolean

(Optional) Enable message compression for serialization. Increases a worker CPU load but decreases network traffic between workers and the queue host. Defaults to false.

vendor?

string

(Optional) Queue adapter vendor name, and the only supported value.

verbose?

boolean

(Optional) Enables/disables verbose logging.

verboseExtended?

boolean

(Optional) Enables/disables extended verbose logging.

watcherCheckDelay?

number

(Optional) Interval in milliseconds of the periodic watcher check.

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