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. Defaults to false.

cleanupFilter

string

Redis glob pattern, appended to the prefix as <prefix>:<cleanupFilter>, selecting which keys the cleanup sweep considers. Defaults to '*' — 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. Defaults to console.

prefix?

string

(Optional) Global key namespace for everything this queue writes. Defaults to 'imq'.

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 that hand-off, not the processing. The worker key is released as soon as the message is dispatched to the message listener, so a worker killed while its handler is still running loses that message exactly as it would with safe delivery off — draining in-flight work before exit is up to the application. Delivery is at-least-once in either mode, so handlers should be idempotent.

safeDeliveryTtl?

number

(Optional) Lease deadline (in milliseconds) stamped onto the worker key when safeDelivery moves a message out of the queue, and the interval on which the watcher sweeps for expired keys. A worker key still present once its deadline has passed is treated as abandoned, and its message is moved back onto the main queue.

This is a recovery deadline for an abandoned hand-off, not a processing deadline. The key is released when the message is dispatched, so a slow handler is neither interrupted nor re-queued for taking too long, and raising this value extends no protection over long-running work — tune it for how quickly an abandoned message should come back.

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. Defaults to 'Redis', which is 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. Defaults to 5000.

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