Setu-TS
    Preparing search index...

    Class RabbitMqQueue

    RabbitMQ queue adapter implementation.

    Uses AMQP 0-9-1 via amqplib. Implements the claim-based reserve pattern to prevent double-dispatch. Uses polling via basicGet (NOT push consume) and per-message TTL + DLX for delayed re-delivery.

    Key topology per job name <n>:

    • he.queue.<n>.ready - Ready queue (polling via basicGet)
    • he.queue.<n>.delay - Delay queue (TTL + DLX → ready)
    • he.queue.<n>.dead - Dead queue (final resting place)

    All queues are reached via the default exchange (routing key = queue name).

    0.1.0

    Implements

    • QueueAdapter
    Index
    isHealthy?: () => Promise<boolean>

    M70c: present only when the connection exposes on?; its absence is unknown reachability, not false. A fault returns false immediately; otherwise a throwaway channel round trip measures reachability. QueueService bounds and caches this probe.

    0.1.0

    • Acknowledges a job as successfully processed.

      Parameters

      • name: string

        Job name

      • id: string

        Job ID (stable public identity)

      • OptionalclaimToken: string

        Opaque claim token returned from reserve (prevents stale settlement)

      Returns Promise<void>

      Resolves when acknowledged

      If the adapter is not connected

      0.1.0

    • Advances a recurring job's next run time.

      Parameters

      • id: string

        Recurring job ID

      • nextRunAtMs: number

        Next run timestamp

      Returns Promise<void>

      Resolves when advanced

      If the adapter is not connected

      0.1.0

    • Moves a job to the dead letter queue.

      Parameters

      • name: string

        Job name

      • id: string

        Job ID (stable public identity)

      • nowMs: number

        Current timestamp in ms (for dead-letter timestamp)

      • OptionalclaimToken: string

        Opaque claim token returned from reserve (prevents stale settlement)

      Returns Promise<void>

      Resolves when dead-lettered

      If the adapter is not connected

      0.1.0

    • Enqueues a job.

      Type Parameters

      • T

      Parameters

      • job: StoredJob<T>

        The job to enqueue

      Returns Promise<void>

      Resolves when enqueued

      If the adapter is not connected

      0.1.0

    • Fetches recurring jobs that are due.

      Parameters

      • nowMs: number

        Current timestamp in ms

      Returns Promise<readonly StoredRecurring[]>

      The due recurring jobs

      If the adapter is not connected

      0.1.0

    • Internal

      Why this adapter cannot use a job name, or null when it can. The derived <prefix>.<name>.ready / .delay queue names (the longest suffixes) must each fit an AMQP short string. The text never quotes the name, which may be caller data. QueueService calls this at process() and addRecurring() so an unusable name fails at registration rather than on every poll.

      Parameters

      • name: string

        The job name

      Returns string | null

      The refusal text, or null

    • Requeues a job with a new available timestamp.

      Type Parameters

      • T

      Parameters

      • name: string

        Job name

      • id: string

        Job ID (stable public identity)

      • availableAtMs: number

        When the job becomes available again

      • attempts: number

        Updated attempt count

      • OptionalclaimToken: string

        Opaque claim token returned from reserve (prevents stale settlement)

      Returns Promise<void>

      Resolves when requeued

      If the adapter is not connected

      0.1.0

    • Reserves up to limit due jobs. Redis scripts use server time; adapters without a server clock compare availableAtMs to nowMs.

      CLAIMS jobs: moves them from ready set to processing set. A reserved job is not returned by subsequent reserve calls.

      Type Parameters

      • T

      Parameters

      • name: string

        Job name

      • limit: number

        Maximum jobs to reserve

      • _nowMs: number

      Returns Promise<readonly StoredJob<T>[]>

      The reserved jobs

      If the adapter is not connected

      0.1.0

    • Stores a recurring job.

      Parameters

      • rec: StoredRecurring

        The recurring job to store

      Returns Promise<void>

      Resolves when stored

      If the adapter is not connected

      0.1.0