alepha@docs:~/docs/packages/alepha$
cat queue.md | pretty
2 min read
Last commit:

#Alepha - Queue

#Installation

Part of the alepha package. Import from alepha/queue.

npm install alepha

#Overview

Message transport used under $job. Not an application-facing API.

There is no queue primitive. Declare background work with $job (alepha/api/jobs) and add AlephaApiJobsQueue when you want dispatch to travel through a broker instead of running in-process.

Delivery at this layer is at-most-once: a message is popped from the backend before the handler runs, so a handler error or a process crash loses it. There is no retry and no dead-letter queue here - $job supplies those with a DB-backed outbox and a reconciliation sweep. (Cloudflare Queues adds broker-level retry/DLQ, configured on the binding.)

Features:

  • Consumers registered imperatively via WorkerProvider.register
  • Polling worker loop with configurable concurrency and backoff
  • Batch send where the backend supports it (QueueProvider.pushMany)
  • Providers: Redis when REDIS_URL is set, Memory otherwise (Node, Bun), Cloudflare Queues (workerd)

Set REDIS_URL and a job pushed by one instance is popped by any of them; leave it unset and the queue lives in this process. An app's own QueueProvider substitution wins over both.

#API Reference

#Providers