Cloudflare Queue

Configure Cloudflare Queues and process named queues in Workers.

Cloudflare Queue fits apps that already run on Cloudflare Workers and want a queue that matches that platform model. ViteHub keeps the queue file structure stable and forwards queue sends and batch handling to Cloudflare Queues.

Configure Cloudflare

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@vitehub/queue/nuxt'],
})

Cloudflare hosting picks the queue provider automatically. Set queue.binding only when you need to pin a specific queue binding name.

Define a queue

server/queues/welcome-email.ts
import { defineQueue } from '@vitehub/queue'

export default defineQueue(async (job) => {
  return {
    email: job.payload?.email,
  }
}, {
  concurrency: 5,
})

What changes on Cloudflare

ConcernBehavior
BindingViteHub derives the queue binding automatically for discovered queues unless you override it.
Batch handlingUse queue.createBatchHandler({ onMessage, onError?, concurrency? }) when you need Cloudflare batch processing.
Local optionsPut concurrency and onError directly inside defineQueue(..., options).
Choose Cloudflare when your queue consumers should run in Workers and batch delivery matters.