@russellthehippo/honker-node
v0.3.3
Published
Node binding for honker — durable queues, streams, pub/sub, and scheduler on SQLite.
Downloads
603
Readme
@russellthehippo/honker-node
Node.js binding for Honker: durable queues, streams, pub/sub, and time-trigger scheduling on SQLite.
Full docs live here:
Install
npm install @russellthehippo/honker-nodeYou also need the Honker SQLite extension. Build it from the main repo or use a release artifact.
Quick start
const honker = require("@russellthehippo/honker-node");
const db = honker.open("app.db");
const q = db.queue("emails");
q.enqueue({ to: "[email protected]" });
for await (const job of q.claim("worker-1")) {
sendEmail(job.payload);
job.ack();
}Delayed jobs use runAt:
q.enqueue({ to: "[email protected]" }, { runAt: Math.floor(Date.now() / 1000) + 10 });Recurring schedules use schedule:
const sched = db.scheduler();
sched.add("fast", { queue: "emails", schedule: "@every 1s", payload: { kind: "tick" } });Supported schedule forms:
0 3 * * **/2 * * * * *@every 1s
Notes
claim()wakes on database updates and on due deadlines.scheduleis the canonical recurring-schedule option.cronstill works as a compatibility alias.
For streams, notify/listen, SQL functions, and full scheduler docs, see the main repo and docs site.
