Wrangler app that uses a Durable Object to publish messages to a queue.
- cdktn-cloudflare-durable-objects-queue - Built with CDKTN instead of Wrangler.
- Cloudflare:
- Must have set the
CLOUDFLARE_API_TOKENvariable in your local environment, with theWorkers Scripts:Edit,Queues:EditandAccount Settings:Readpermissions.
- Must have set the
- mise:
- Install mise, which manages Node and pnpm.
mise install
pnpm installCreate queue:
pnpm wrangler queues create my-queueCreate worker:
pnpm run deploy-
Grab the
<WORKER_ROUTE_TRIGGER_URL>from the deployment outputs:Published my-worker <WORKER_ROUTE_TRIGGER_URL> Producer for my-queue
-
Navigate to
https://my-worker.<SUBDOMAIN>.workers.dev?userId=test. -
Check that a message is present in
my-queuefrom the Cloudflare dashboard.
pnpm wrangler delete