Core - v1.0.0
    Preparing search index...

    Interface MessageQueue<T, TRuntime>

    A producer that hands work to something else to finish later.

    Producing only. Consuming is an entrypoint concern — the runtime delivers a batch to a handler rather than the application asking for one — so it is not expressible as a method here and does not belong on this interface.

    Enqueueing returns a boolean rather than throwing because the work is by definition not what the caller is waiting on: the request that triggered it should still succeed when the follow-up could not be scheduled, and the caller decides whether that is worth logging. An unavailable queue reports false for the same reason.

    Bayu Dwiyan Satria

    1.0.0

    1.0.0

    interface MessageQueue<T = unknown, TRuntime = unknown> {
        enqueue(
            runtime: TRuntime,
            message: T,
            delaySeconds?: number,
        ): Promise<boolean>;
        enqueueAll(runtime: TRuntime, messages: T[]): Promise<boolean>;
        isAvailable(runtime: TRuntime): boolean;
    }

    Type Parameters

    • T = unknown

      The message body.

    • TRuntime = unknown

      The runtime handle the queue is resolved from.

    Hierarchy (View Summary)

    Implemented by

    Index
    • Enqueues one message.

      Parameters

      • runtime: TRuntime

        The runtime handle.

      • message: T

        The message body.

      • OptionaldelaySeconds: number

        Delay before the message becomes visible to consumers.

      Returns Promise<boolean>

      true when the message was accepted.

    • Reports whether the capability is actually usable on this runtime.

      Parameters

      Returns boolean

      true when calls will reach a real backing resource.

      A capability backed by an optional resource answers false when that resource was never provisioned. Implementations must document what each method does in that state — degrade or throw — and must not vary it, since a caller choosing between two implementations is relying on the answer meaning the same thing in both.