In-memory queue adapter implementation.
-
ack(): Promise<void>name: string,id: string,_claimToken?: string
Acknowledges a job as successfully processed.
-
advanceRecurring(): Promise<void>id: string,nextRunAtMs: number
Advances a recurring job's next run time.
-
connect(): Promise<void>
Connects the adapter to its backend.
-
deadLetter(): Promise<void>name: string,id: string,_nowMs: number,_claimToken?: string
Moves a job to the dead letter queue.
-
depths(name: string): Promise<QueueDepths>
M70k (X8-4): counts this name's three states. Free for an in-process store, so there is no reason to omit it.
-
disconnect(): Promise<void>
Disconnects the adapter.
-
enqueue<T>(job: StoredJob<T>): Promise<void>
Enqueues a job.
-
fetchRecurringDue(nowMs: number): Promise<readonly StoredRecurring[]>
Fetches recurring jobs that are due.
-
getDeadLetters<T>(name: string): readonly StoredJob<T>[]
Returns the jobs dead-lettered under a queue name, in the order they were dead-lettered. A job lands here once it fails on its final attempt; the queue never delivers it again.
-
isHealthy(): Promise<boolean>
M70c: an in-memory queue has no backend to be unreachable, so it is always reachable (M47).
-
isReady(): boolean
Checks if the adapter is ready/connected.
-
requeue<T>(): Promise<void>name: string,id: string,availableAtMs: number,attempts: number,_claimToken?: string
Requeues a job with a new available timestamp.
-
reserve<T>(): Promise<readonly StoredJob<T>[]>name: string,limit: number,nowMs: number
Reserves up to
limitjobs that are due (availableAtMs <= nowMs). -
storeRecurring(rec: StoredRecurring): Promise<void>
Stores a recurring job.
RabbitMQ queue adapter implementation.
-
ack(): Promise<void>name: string,id: string,_claimToken?: string
Acknowledges a job as successfully processed.
-
advanceRecurring(): Promise<void>id: string,nextRunAtMs: number
Advances a recurring job's next run time.
-
connect(): Promise<void>
Connects the adapter to its backend.
-
deadLetter(): Promise<void>name: string,id: string,nowMs: number,_claimToken?: string
Moves a job to the dead letter queue.
-
disconnect(): Promise<void>
Disconnects the adapter.
-
enqueue<T>(job: StoredJob<T>): Promise<void>
Enqueues a job.
-
fetchRecurringDue(nowMs: number): Promise<readonly StoredRecurring[]>
Fetches recurring jobs that are due.
-
isHealthy: () => Promise<boolean>
M70c: present only when the connection exposes
on?; its absence is unknown reachability, notfalse. -
isReady(): boolean
Checks if the adapter is ready/connected.
-
requeue<T>(): Promise<void>name: string,id: string,availableAtMs: number,attempts: number,_claimToken?: string
Requeues a job with a new available timestamp.
-
reserve<T>(): Promise<readonly StoredJob<T>[]>name: string,limit: number,_nowMs: number
Reserves up to
limitjobs that are due (availableAtMs <= nowMs). -
storeRecurring(rec: StoredRecurring): Promise<void>
Stores a recurring job.
Redis queue adapter implementation.
-
ack(): Promise<void>name: string,id: string,_claimToken?: string
Acknowledges a job as successfully processed.
-
advanceRecurring(): Promise<void>id: string,nextRunAtMs: number
Advances a recurring job's next run time.
-
connect(): Promise<void>
Connects the adapter to its backend.
-
deadLetter(): Promise<void>name: string,id: string,nowMs: number,_claimToken?: string
Moves a job to the dead letter queue.
-
depths: (name: string) => Promise<QueueDepths>
M70k (X8-4): counts this name's three states with one
ZCARDeach. -
disconnect(): Promise<void>
Disconnects the adapter.
-
enqueue<T>(job: StoredJob<T>): Promise<void>
Enqueues a job.
-
fetchRecurringDue(nowMs: number): Promise<readonly StoredRecurring[]>
Fetches recurring jobs that are due.
-
isHealthy: () => Promise<boolean>
M70c: present only when the client exposes
ping(); its absence is unknown reachability, notfalse(a minimal injected fake has not told us the server is dead). -
isReady(): boolean
Checks if the adapter is ready/connected.
-
requeue<T>(): Promise<void>name: string,id: string,availableAtMs: number,attempts: number,_claimToken?: string
Requeues a job with a new available timestamp.
-
reserve<T>(): Promise<readonly StoredJob<T>[]>name: string,limit: number,nowMs: number
Reserves up to
limitjobs that are due (availableAtMs <= nowMs). -
storeRecurring(rec: StoredRecurring): Promise<void>
Stores a recurring job.
SNS publisher for fan-out messaging.
- connect(): Promise<void>
- disconnect(): Promise<void>
- isReady(): boolean
-
publish(message: unknown): Promise<string | undefined>
Publish a message to the configured SNS topic.
Thrown by SqsQueue when a job delay exceeds SQS's 900 s
DelaySeconds ceiling. The delay is NOT clamped (a clamp runs the job
early); the caller must adjust the value.
SQS queue adapter.
-
ack(): Promise<void>name: string,id: string,claimToken: string
Acknowledges a job as successfully processed.
-
advanceRecurring(): Promise<void>id: string,nextRunAtMs: number
Advances a recurring job's next run time.
-
connect(): Promise<void>
Connects the adapter to its backend.
-
deadLetter(): Promise<void>name: string,id: string,_nowMs: number,claimToken: string
Moves a job to the dead letter queue.
-
disconnect(): Promise<void>
Disconnects the adapter.
-
enqueue<T>(job: StoredJob<T>): Promise<void>
Enqueues a job.
-
fetchRecurringDue(nowMs: number): Promise<readonly StoredRecurring[]>
Fetches recurring jobs that are due.
-
isHealthy: () => Promise<boolean>
M70c: present only when the transport exposes
isHealthy?()(the real adapter issuesGetQueueAttributes); its absence is unknown reachability, notfalse. -
isReady(): boolean
Checks if the adapter is ready/connected.
-
requeue(): Promise<void>name: string,id: string,availableAtMs: number,_attempts: number,claimToken: string
Requeues a job with a new available timestamp.
-
reserve<T>(): Promise<readonly StoredJob<T>[]>name: string,limit: number,nowMs: number
Reserves up to
limitjobs that are due (availableAtMs <= nowMs). -
storeRecurring(rec: StoredRecurring): Promise<void>
Stores a recurring job.
Thrown by SqsQueue when a job name is not mapped in the
queues configuration. The error message names the job name and the
configured names.
Adapts the real AWS SNS SDK v3 module to the domain port.
Adapts the real AWS SQS SDK v3 module to the domain port.
Lazy-load the AWS SNS SDK v3.
Lazy-load the AWS SQS SDK v3.
Creates a queue plugin.
Options accepted when enqueueing a job.
-
delayMs: number
Delay before the job becomes available, in milliseconds.
-
headers: Readonly<Record<string, string>>
Transport headers to carry with the job, delivered to the processor as
IJob.headers. -
maxAttempts: number
Maximum attempts before the job is dead-lettered.
A queued job delivered to a processor.
-
attempts: number
How many times this job has been attempted (1 on first delivery).
-
data: T
The job payload.
-
headers: Readonly<Record<string, string>>
Transport headers carried with the job, mirroring
MessageMetadata.headersso the two ingresses cannot drift on meaning:{}means the channel was read and carried nothing; absent means there was no channel. -
id: string
Queue-assigned job ID.
-
name: string
The job name it was enqueued under.
Background job queue.
-
add<T>(): Promise<string>name: string,data: T,options?: AddJobOptions
Enqueues a job.
-
addRecurring<T>(): Promise<void>name: string,data: T,options: RecurringOptions
Schedules a recurring job.
-
process<T>(): voidname: string,processor: JobProcessor<T>,options?: ProcessOptions
Registers a processor for a job name.
Domain port for SNS operations.
-
close(): Promise<void>
Close the client.
-
publish(): Promise<string | undefined>topicArn: string,body: string
Publish a message to a topic. Returns the message ID or undefined.
Domain port for SQS operations. The adapter depends on this, not the SDK.
-
changeVisibility(): Promise<void>queueUrl: string,receiptHandle: string,seconds: number
Change visibility timeout (requeue).
-
close(): Promise<void>
Close the client.
-
delete(): Promise<void>queueUrl: string,receiptHandle: string
Delete a message (ack).
-
isHealthy(): Promise<boolean>
M70c: reports whether the queue is reachable — the real adapter issues
GetQueueAttributes. Optional so a minimal injected fake still type-checks; a transport that omits it is unknown, notfalse. -
receive(): Promise<readonly SqsReceivedMessage[]>queueUrl: string,max: number,visibilitySeconds: number
Receive messages from a queue.
-
send(): Promise<void>queueUrl: string,body: string,delaySeconds?: number
Send a message to a queue.
Options accepted when registering a processor.
-
concurrency: number
Jobs processed concurrently by this worker (default 1).
-
onFailed: () => void | Promise<void>job: IJob,error: unknown
Invoked once when a job has exhausted its attempts, immediately before it is dead-lettered — the only programmatic notice that work was permanently abandoned. It does NOT fire on an attempt that will be retried.
How many jobs are in each of one name's states.
-
dead: number
Jobs that exhausted their attempts and were dead-lettered.
-
processing: number
Jobs reserved and being processed.
-
ready: number
Jobs available to be reserved now or later.
Minimal logger surface the service reports through — structurally compatible
with ILogger so the plugin can pass the resolved logger capability without
this package depending on the logger plugin.
-
error(): voidmessage: string,metadata?: Record<string, unknown>
Logs at
errorseverity.
Options for configuring the queue plugin.
-
adapter: QueueAdapterType
The adapter type to use (default 'memory').
-
behaviors: readonly (IIngressBehavior | RegistryFactory<IIngressBehavior>)[]
Ingress behaviours wrapped around every processor — the queue arm of the transport-neutral behaviour chain shared with the websocket, scheduler, and messaging plugins (
IIngressBehaviorin@setu-ts/common). -
client: IRedisQueueClient | IAmqpQueueConnection
Injected client (bypasses lazy import).
-
deadLetterTtlMs: number
How long a dead-lettered job's payload is retained, in milliseconds.
-
defaultMaxAttempts: number
Default max attempts for jobs (default 3).
-
name: string
Instance name for multi-instance support.
-
pollIntervalMs: number
Poll interval for worker loop (default 1000ms).
-
prefix: string
Queue name prefix for RabbitMQ adapter (default 'he.queue').
-
processors: readonly QueueProcessorEntry[]
Processors registered declaratively, as an alternative to calling
queue.process(name, processor, options)imperatively afterstart(). Each entry — instance orRegistryFactory— produces oneprocess()call, so a processor can be declared where the plugin is composed instead of after the application has started. -
sqs: import("../adapters/sqs-queue.ts").SqsQueueOptions
SQS-specific options (required when adapter is 'sqs').
-
url: string
Connection URL (used when adapter is 'redis' or 'rabbitmq').
The declarative form of one IQueue.process() call — the entry an
application writes instead of calling process() imperatively after
start().
-
name: string
The job name this processor handles (the
process()name argument). -
options: ProcessOptions
Per-name configuration, exactly as the imperative
process()accepts. -
processor: JobProcessor
Invoked per delivered job, exactly as the imperative
process()accepts.
Options for configuring RabbitMqQueue.
-
client: IAmqpQueueConnection
Injected AMQP connection (bypasses lazy import).
-
prefix: string
Queue name prefix (default 'he.queue').
-
url: string
RabbitMQ connection URL (default 'amqp://localhost:5672').
Options accepted when scheduling a recurring job.
-
cron: string
Cron expression controlling the schedule.
Options for configuring RedisQueue.
-
client: IRedisQueueClient
Injected Redis client (bypasses lazy import).
-
deadLetterTtlMs: number
How long a dead-lettered job's payload is retained, in milliseconds; see QueuePluginOptions.deadLetterTtlMs.
-
url: string
Redis connection URL (default 'redis://localhost:6379').
Options for SNS publisher.
-
client: ISnsTransport
Injected transport (bypasses lazy SDK load).
-
credentials: unknown
AWS credentials (for lazy SDK load).
-
endpoint: string
Custom endpoint URL (for local testing).
-
region: string
AWS region (for lazy SDK load).
-
topicArn: string
Target SNS topic ARN.
Declares the constructors used from the real AWS SNS SDK v3.
Options for SQS queue adapter.
-
client: ISqsTransport
Injected transport (bypasses lazy SDK load).
-
credentials: unknown
AWS credentials (for lazy SDK load).
-
deadLetterQueues: Record<string, string>
Job name → dead-letter queue URL mapping (optional).
-
endpoint: string
Custom endpoint URL (for ElasticMQ / local testing).
-
queues: Record<string, string>
Job name → queue URL mapping.
-
region: string
AWS region (for lazy SDK load).
-
visibilityTimeoutSeconds: number
Visibility timeout in seconds for claims (default 30).
A message received from SQS with its receipt handle.
-
approximateReceiveCount: string | undefined
Approximate receive count (system attribute). May be undefined if the attribute is not requested.
-
body: string
The message body (JSON string).
-
receiptHandle: string
Receipt handle for settle operations.
Declares the constructors used from the real AWS SQS SDK v3.
- ChangeMessageVisibilityCommand: new (input: Record<string, unknown>) => unknown
- DeleteMessageCommand: new (input: Record<string, unknown>) => unknown
- ReceiveMessageCommand: new (input: Record<string, unknown>) => unknown
- SQSClient: new (config: { region?: string | undefined; credentials?: unknown; endpoint?: string | undefined; }) => { send(command: unknown): Promise<unknown>; destroy(): Promise<void>; }
- SendMessageCommand: new (input: Record<string, unknown>) => unknown
Processes jobs of one name.
Queue adapter type for plugin configuration.
| RegistryFactory<QueueProcessorDefinition>
One entry of QueuePluginOptions.processors: a processor
definition, or a RegistryFactory producing one when the
processor needs a resolved capability.
Usage
import * as Queue_plugin_for_Setu_TS___Provides_background_job_queue_capability_with_Memory__Redis__RabbitMQ__and_SQS_adapters__plus_an_SNS_publisher_for_fan_out_messaging_ from "queue-plugin/src/index.ts";