Skip to main content

Built and signed on GitHub Actions

Works with
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
•JSR Score100%•
License
Apache-2.0
•
Downloads296/wk
•
Publisheda day ago (0.0.10)

A provider-agnostic message queue for NetScript: enqueue and drain background jobs through one MessageQueue contract, auto-discovering a RabbitMQ, Redis, or Deno KV backend from the Aspire environment.

Testing helpers for @netscript/queue.

Classes

c

In-memory dead-letter store for queue contract tests.

  • append(record: DeadLetterRecord<T>): Promise<void>

    Append the first terminal record for each queue/message identity.

  • depth(): Promise<number>

    Count stored records.

  • list(options?: { limit?: number; }): Promise<DeadLetterRecord<T>[]>

    List stored records.

  • reprocess(
    reenqueue: (record: DeadLetterRecord<T>) => Promise<void>,
    options?: { limit?: number; }
    ): Promise<number>

    Claim records before requeue, restoring them when the callback rejects. A message that fails again during requeue keeps its new terminal record.

c
MemoryQueueAdapter<T = unknown>(options?: MemoryQueueAdapterOptions)

In-memory implementation of MessageQueue for port-contract tests.

  • drain(): T[]

    Return and remove all pending messages.

  • enqueue(
    message: T,
    options?: EnqueueOptions
    ): Promise<void>

    Enqueue one message in memory.

  • enqueueMany(
    messages: T[],
    options?: EnqueueOptions
    ): Promise<void>

    Enqueue messages sequentially using the same options.

  • listen(
    handler: (
    message: T,
    context: MessageContext
    ) => Promise<void>
    ,
    options?: ListenOptions
    ): Promise<void>

    Listen for memory messages until stopped or aborted.

  • nativeRetrial: boolean

    The memory adapter retries messages in-process rather than through backend-native delivery.

  • stop(): Promise<void>

    Stop the active memory listener.

Interfaces

  • deadLetterStore: DeadLetterStorePort

    Optional store for terminal nacks.

  • pollInterval: number

    Delay in milliseconds between empty queue polls while listening.

Add Package

deno add jsr:@netscript/queue

Import symbol

import * as mod from "@netscript/queue/testing";
or

Import directly with a jsr specifier

import * as mod from "jsr:@netscript/queue@^0.0.10/testing";