Skip to content
Start here

List Queue Consumers

client.queues.consumers.list(stringqueueId, ConsumerListParams { account_id } params, RequestOptionsoptions?): SinglePage<Consumer>
GET/accounts/{account_id}/queues/{queue_id}/consumers

Returns the consumers for a Queue

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Queues WriteQueues ReadWorkers Scripts WriteWorkers Scripts Read
ParametersExpand Collapse
queueId: string

A Resource identifier.

maxLength32
params: ConsumerListParams { account_id }
account_id: string

A Resource identifier.

maxLength32
ReturnsExpand Collapse
Consumer = MqWorkerConsumerResponse { consumer_id, created_on, dead_letter_queue, 4 more } | MqHTTPConsumerResponse { consumer_id, created_on, dead_letter_queue, 3 more }

Response body representing a consumer

One of the following:
MqWorkerConsumerResponse { consumer_id, created_on, dead_letter_queue, 4 more }
consumer_id?: string

A Resource identifier.

maxLength32
created_on?: string
formatdate-time
dead_letter_queue?: string

Name of the dead letter queue, or empty string if not configured

queue_name?: string
script_name?: string

Name of a Worker

settings?: Settings { batch_size, max_concurrency, max_retries, 2 more }
batch_size?: number

The maximum number of messages to include in a batch.

max_concurrency?: number

Maximum number of concurrent consumers that may consume from this Queue. Set to null to automatically opt in to the platform's maximum (recommended).

max_retries?: number

The maximum number of retries

max_wait_time_ms?: number

The number of milliseconds to wait for a batch to fill up before attempting to deliver it

retry_delay?: number

The number of seconds to delay before making the message available for another attempt.

type?: "worker"
MqHTTPConsumerResponse { consumer_id, created_on, dead_letter_queue, 3 more }
consumer_id?: string

A Resource identifier.

maxLength32
created_on?: string
formatdate-time
dead_letter_queue?: string

Name of the dead letter queue, or empty string if not configured

queue_name?: string
settings?: Settings { batch_size, max_retries, retry_delay, visibility_timeout_ms }
batch_size?: number

The maximum number of messages to include in a batch.

max_retries?: number

The maximum number of retries

retry_delay?: number

The number of seconds to delay before making the message available for another attempt.

visibility_timeout_ms?: number

The number of milliseconds that a message is exclusively leased. After the timeout, the message becomes available for another attempt.

type?: "http_pull"

List Queue Consumers

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const consumer of client.queues.consumers.list('023e105f4ecef8ad9ca31a8372d0c353', {
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
})) {
  console.log(consumer);
}
{
  "errors": [
    {
      "code": 7003,
      "message": "No route for the URI",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": [
    {
      "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353",
      "created_on": "2019-12-27T18:11:19.117Z",
      "dead_letter_queue": "dead_letter_queue",
      "queue_name": "example-queue",
      "script_name": "my-consumer-worker",
      "settings": {
        "batch_size": 50,
        "max_concurrency": 10,
        "max_retries": 3,
        "max_wait_time_ms": 5000,
        "retry_delay": 10
      },
      "type": "worker"
    }
  ],
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 7003,
      "message": "No route for the URI",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    "string"
  ],
  "result": [
    {
      "consumer_id": "023e105f4ecef8ad9ca31a8372d0c353",
      "created_on": "2019-12-27T18:11:19.117Z",
      "dead_letter_queue": "dead_letter_queue",
      "queue_name": "example-queue",
      "script_name": "my-consumer-worker",
      "settings": {
        "batch_size": 50,
        "max_concurrency": 10,
        "max_retries": 3,
        "max_wait_time_ms": 5000,
        "retry_delay": 10
      },
      "type": "worker"
    }
  ],
  "success": true
}