Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 1013 Bytes

File metadata and controls

60 lines (43 loc) · 1013 Bytes

Getting Started with JetQueue

Installation

npm install @jet-queue/core

# or 

pnpm add @jet-queue/core

# or 

yarn add @jet-queue/core

Your First Queue

import { JetQueue } from "@jet-queue/core";

const queue = new JetQueue({ concurrency: 3 });

queue.add(
  async () => {
    console.log("Job done!");
  },
  { name: "my-first-job" },
);

queue.on("queue:drain", () => {
  console.log("All jobs finished");
});

Using the Server (Bun)

npx @jet-queue/server --port 3001

Tip

you can use whatever package manger you want, here is the npm example

Then connect with the client:

npm install @jet-queue/client
import { JetQueueClient } from "@jet-queue/client";
const client = new JetQueueClient({ baseUrl: "http://localhost:3001" });
await client.addJob("send-email", { data: { to: "user@test.com" } });

Next Steps