Skip to content
renkudocs
GuidesQueues and email

Queues and email

Add background processing after your routed app works. Queue handlers run alongside HTTP and authentication handlers, with their environment passed explicitly.

On this page

Import bindings and triggers from renku. Configure worker.env.EMAIL with bindings.sendEmail({ allowedSenderAddresses: ["notifications@example.com"] }) to use Cloudflare Email Sending.

  • Declare the queue in worker.env with bindings.queue({ name: "email-events" }). cf deploy --prebuilt creates it if missing and reuses it by name.
  • Add worker.triggers with triggers.queue({ name: "email-events" }) to attach the consumer. A consumer trigger alone references an existing queue.
  • Declare a dead-letter queue as another bindings.queue when using deadLetterQueue.

Set queue: "./src/email-events.ts" on defineConfig. The module exports a default async function receiving (batch, env, ctx).

It runs alongside routed HTTP and auth handlers. A configured queue handler replaces any queue method on a custom entrypoint. Queue handlers receive their environment explicitly and have no HTTP request context.

The deployment API token needs Queues write permission. Cloudflare domain onboarding and Email Sending event subscriptions are separate account setup steps.

You can attach background queue handlers and identify the account setup needed for Email Sending.

Continue to build and deploy

← All guides · Explore the docs source (access required) →