cloudflare_queue
Run Drupal's queue system on Cloudflare Queues with no code changes. Opt a queue (cron queues, the Batch API, or a custom queue worker) onto the Cloudflare backend in settings.php, and items are enqueued and consumed over the Cloudflare Queues HTTP pull/ack API.
Cloudflare Queues is a managed, global message queue. Unlike most queue backends, you do not stand up or wire a broker: the queue is provisioned and tracked for you by the Cloudflare Compute module, and this module runs Drupal's queue on it.
Features
- Implements Drupal's ReliableQueueInterface, so existing queue workers run unchanged.
- Consumes a queue provisioned and tracked by Cloudflare Compute (its id and credentials come from the queue asset); no broker to operate.
- At-least-once delivery over the Cloudflare Queues HTTP pull/ack API, with visibility-timeout leases and retries.
- Swappable payload codec: JSON by default, or an opt-in PHP-serialize codec that preserves object payloads.
Post-Installation
- Provision a Cloudflare queue with the Cloudflare Compute module (its deploy wizard or Queues admin), or register an existing one.
- Opt a Drupal queue onto the backend in settings.php, for example:
$settings['queue_service_my_worker'] = 'queue.cloudflare'; - Optionally change the Cloudflare queue-name prefix (default "drupal-") in the module settings.
Additional Requirements
Requires the Cloudflare API (cloudflare_api), Cloudflare SDK (cloudflare_sdk) and Cloudflare Compute (cloudflare_compute) modules, and a Cloudflare API token with Queues Edit permission (queues#read and queues#write). Install with Composer:
composer require drupal/cloudflare_queue
Recommended modules/libraries
None beyond the required dependencies. Cloudflare Compute (a hard dependency) provisions and tracks the queue this backend runs on.
Similar projects
Like the core database queue, or backends such as RabbitMQ and AWS SQS, this provides a Drupal queue implementation. The difference is provisioning: the queue is created and tracked for you as configuration (by Cloudflare Compute), and it runs over Cloudflare's global HTTP API with no broker or separate worker to operate.
Supporting this Module
Issue reports, patches and feedback are welcome in the project's issue queue.
Community Documentation
- Cloudflare Queues: https://developers.cloudflare.com/queues/
- Pull consumers: https://developers.cloudflare.com/queues/configuration/pull-consumers/