Cloudflare - v1.3.0
    Preparing search index...

    Class QueueService<T, E>

    Background-work capability, backed by Cloudflare Queues.

    Enqueuing is deliberately forgiving: work that cannot be queued should not fail the request that triggered it, so these methods report failure through their return value rather than throwing. Consumers live in a separate Worker — this side only produces.

    Bayu Dwiyan Satria

    1.0.0

    1.0.0

    Type Parameters

    Implements

    • MessageQueue<T, E>
    Index
    • Reads the queue's current backlog.

      Parameters

      • env: E

        The Worker environment.

      Returns Promise<QueueMetrics>

      The queue metrics.

    • Enqueues a message.

      Parameters

      • env: E

        The Worker environment.

      • message: T

        The payload.

      • OptionaldelaySeconds: number

        How long before consumers can see it. Falls back to the configured delay.

      Returns Promise<boolean>

      true when the message was accepted.

    • Enqueues several messages in one call.

      A batch bills as a single write regardless of how many messages it carries, so prefer this over sending in a loop.

      Parameters

      • env: E

        The Worker environment.

      • messages: T[]

        The payloads.

      Returns Promise<boolean>

      true when the batch was accepted.

    • Reports whether the queue is bound to this Worker.

      Parameters

      • env: E

        The Worker environment.

      Returns boolean

      true when the binding is present.