spacebull
v0.0.1
Published
BullMQ-compatible job queue backed by SpacetimeDB
Maintainers
Readme
spacebull
A BullMQ-compatible job queue client backed by SpacetimeDB instead of Redis.
SpaceBull reimplements BullMQ's queue semantics as a SpacetimeDB module. This package is the Node.js client: same classes, methods, job options, and event names as BullMQ, so BullMQ application code ports by changing only the connection configuration.
import { Queue, Worker, QueueEvents } from 'spacebull';
const connection = { uri: 'http://127.0.0.1:3777', database: 'spacebull' };
const queue = new Queue('my-queue', { connection });
const job = await queue.add('send-email', { to: '[email protected]' });
const worker = new Worker('my-queue', async job => ({ sent: true }), { connection });
worker.on('completed', job => console.log(`${job.id} done`));
const events = new QueueEvents('my-queue', { connection });
console.log(await job.waitUntilFinished(events)); // { sent: true }The client connects to a SpacetimeDB instance running the SpaceBull module
(http://127.0.0.1:3777, database spacebull by default; override with the
SPACEBULL_URI / SPACEBULL_DATABASE / SPACEBULL_TOKEN environment variables or the
connection option).
Supported BullMQ features: retries/backoff, delayed jobs, priorities, pause/resume,
stalled-job recovery, rate limiting, deduplication, drain/clean/obliterate, flows
(FlowProducer), job schedulers (cron/every), queue events, and waitUntilFinished.
Conformance against BullMQ's own test suites is tracked in
CONFORMANCE.md.
See the SpaceBull repository for the server module, the Rust client, an admin CLI, a live TUI, and a web dashboard.
License
MIT
