@russellthehippo/honker-bun
v0.2.2
Published
Bun binding for Honker — durable queues, streams, pub/sub, and scheduler on SQLite.
Readme
honker-bun
Bun binding for Honker: durable queues, streams, pub/sub, and time-trigger scheduling on SQLite.
Full docs:
Install
bun add @russellthehippo/honker-bunYou also need the Honker SQLite extension from the main repo.
Watcher backends
open(path, extPath, { watcherBackend: "polling" }) accepts the
default polling backend aliases ("polling" / "poll"). Experimental
"kernel" / "shm" requests route through honker-core via the loaded
Honker extension and fail loudly if that extension was not built with
the matching feature.
Quick start
import { open } from "@russellthehippo/honker-bun";
const db = open("app.db", "./libhonker_ext.dylib");
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
For full API docs and SQL details, see the main repo and docs site.
