hono-worker-queue-do (Example)
한국어 번역본이 없어 영문 예제 문서를 표시합니다.
Hono + Cloudflare Workers template where queue state is managed in a Durable Object and send execution is processed asynchronously.
Provider used in this template: IWINV.
This template does not require nodejs_compat.
What this example shows
섹션 제목: “What this example shows”POST /queue/sendenqueues send jobs into a DO-backed queue- Queue processing runs in the DO via
alarm()and can be manually triggered withPOST /queue/drain KMsgsend execution is isolated in the DO (single coordination point per queue name)- Queue responses expose both:
queueName: requested external queue namequeueId: internal Durable Object identifier
Setup
섹션 제목: “Setup”cd examples/hono-worker-queue-dobun installcp .dev.vars.example .dev.varsFill .dev.vars:
IWINV_API_KEY=...IWINV_SMS_API_KEY=...IWINV_SMS_AUTH_KEY=...IWINV_SMS_SENDER_NUMBER=01000000000QUEUE_NAME=defaultGenerate worker types once after config changes:
bun run typesLocal dev (Wrangler)
섹션 제목: “Local dev (Wrangler)”bun run devWrangler starts a local worker with local Durable Object storage.
API examples
섹션 제목: “API examples”Enqueue:
curl -X POST http://127.0.0.1:8787/queue/send \ -H "content-type: application/json" \ -d '{ "to":"01012345678", "text":"hello from durable object queue", "delayMs":0, "maxAttempts":3 }'Drain immediately (optional):
curl -X POST http://127.0.0.1:8787/queue/drain \ -H "content-type: application/json" \ -d '{"maxJobs":10}'Check queue size:
curl http://127.0.0.1:8787/queue/sizeCheck specific job:
curl "http://127.0.0.1:8787/queue/jobs/<JOB_ID>"Sample enqueue response:
{ "ok": true, "data": { "queueName": "default", "queueId": "f3f3f13f3f13f3f13f3f13f3f13f3f13", "jobId": "kmsg_jobs_...", "processAt": "2026-02-17T00:00:00.000Z" }}