catqueue is a streamlined job queue solution designed for Node.js applications that leverages PostgreSQL as its sole data broker. By eliminating the need for Redis, it simplifies architecture while offering robust features like job dependencies, automatic cleanup, and built-in TypeScript support.
catqueue is a PostgreSQL-native job queue designed for Node.js that operates without the need for an external Redis broker. If PostgreSQL is already part of the stack, catqueue provides a streamlined solution utilizing just one table, a single migration, and three primary methods to manage jobs effectively.
Here's how to quickly get started with catqueue in your application:
import { CatQueue } from "catqueue";
const queue = new CatQueue({
connectionString: process.env.DATABASE_URL!,
});
// Register handlers
queue.register("send-email", async (payload) => {
await mailer.send({ to: payload.to, subject: payload.subject });
});
// Start worker
queue.start();
// Enqueue a job
const jobId = await queue.enqueue("send-email", {
to: "user@example.com",
subject: "Welcome!",
});
The lifecycle of a job within catqueue follows a structured path:
PENDING → PROCESSING → COMPLETED
In the event of a failure, jobs can be retried with exponential backoff until they reach a dead status after exceeding the maximum retry attempts.
Opt for catqueue when:
Consider BullMQ if the use case demands:
For further information, including benchmark comparisons and a complete API reference, consult the extensive documentation within the repository.
Catqueue streamlines job management and enhances your Node.js applications with a simple yet powerful job queue solution.
No comments yet.
Sign in to be the first to comment.