Durable outbound deliveries with retry backoff, manual replay and content scrubbing.

Implements

Constructors

Methods

  • Advances retry backoff, giving up a day after the first failed attempt. A delivery no longer pending (delivered, or given up) is left as it is.

    Parameters

    • id: string
    • now: number

    Returns Promise<void>

  • Resets attempts and makes a delivery due now without restoring any purged payload; a mail delivery is never replayed.

    Parameters

    • id: string
    • now: number

    Returns Promise<void>

  • Moves a pending delivery's next attempt to notBefore, never earlier than it is, without counting an attempt.

    Parameters

    • id: string
    • notBefore: number

    Returns Promise<boolean>

  • Ends every pending delivery of the run to the destination, their mail bodies emptied.

    Parameters

    • runId: string
    • destinationRef: string

    Returns Promise<boolean>

  • Fences new content and scrubs content deliveries, including delivered rows; content-free deliveries keep their type and payload. A send of the run that sendClaimed has under way in this process and that has not written its body yet stops.

    Parameters

    • runId: string

    Returns Promise<void>

  • Sends one delivery as the table holds it now, not as due returned it: one gone or no longer pending is skipped (false). The signal send gets aborts when this outbox's purgeContent purges the delivery's run, so a send that has not written its body yet stops (false); any other rejection is send's. A purge committed through another instance or process reaches a send only through the re-read, so the manager that purges and the dispatcher take the same SqlOutbox.

    Parameters

    • candidate: OutboxDelivery

      A delivery due returned.

    • send: ((fresh, signal) => Promise<void>)

      Sends the fresh copy under the signal.

        • (fresh, signal): Promise<void>
        • Parameters

          Returns Promise<void>

    Returns Promise<boolean>