In-memory queue adapter implementation.
Provides a simple, synchronous-in-practice implementation using in-process data structures. All methods are wrapped in Promises to match the async adapter interface.
ack(name: string,id: string,_claimToken?: string): Promise<void>
Acknowledges a job as successfully processed.
advanceRecurring(id: string,nextRunAtMs: number): Promise<void>
Advances a recurring job's next run time.
connect(): Promise<void>
Connects the adapter to its backend.
deadLetter(name: string,id: string,_nowMs: number,_claimToken?: string): Promise<void>
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.
This is MemoryQueue-only observability: the Redis transport keeps its
dead set in Redis, so inspect it there.
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>(name: string,id: string,availableAtMs: number,attempts: number,_claimToken?: string): Promise<void>
Requeues a job with a new available timestamp.
reserve<T>(name: string,limit: number,nowMs: number): Promise<readonly StoredJob<T>[]>
Reserves up to limit jobs that are due (availableAtMs <= nowMs).
CLAIMS jobs: moves them from ready set to processing set. A reserved job is not returned by subsequent reserve calls.
storeRecurring(rec: StoredRecurring): Promise<void>
Stores a recurring job.