Skip to content

Getting started

This is a five-minute walkthrough. By the end, you will have Redis running, a queue producing one job, and a worker consuming it.

The path here uses the Node binding because it has the widest reach. Python and Rust quickstarts are inline below — pick whichever you ship in production.

  • Docker, or Redis 8.6+ already on your machine.
  • One of: Node.js 18+, Python 3.9+, or Rust 1.85+ (2024 edition).

ChasquiMQ targets Redis 8.6+ for the modern Streams feature set (XACKDEL, idempotent XADD, idle-pending reads). Older Redis is not supported.

Terminal window
docker run -d --name chasquimq-redis -p 6379:6379 redis:8.6

Verify it answers:

Terminal window
docker exec chasquimq-redis redis-cli PING
# PONG

In a fresh directory:

Terminal window
npm init -y && npm pkg set type=module
npm install chasquimq tsx

Prebuilt binaries ship for darwin / linux / win32 on arm64 + x64. There is no install-time compilation. tsx runs the TypeScript snippet below without a build step; type=module enables top-level await.

Save the snippet from your tab as hello.ts, hello.py, or src/main.rs, then run it.

hello.ts
import { Queue, Worker } from "chasquimq";
const connection = { host: "127.0.0.1", port: 6379 };
const queue = new Queue("emails", { connection });
const worker = new Worker(
"emails",
async (job) => {
console.log(`[worker] sending email to ${job.data.to}`);
return { delivered: true };
},
{ connection, storeResults: true },
);
const job = await queue.add("welcome", { to: "ada@example.com" });
await job.waitForResult({ timeoutMs: 30_000 });
await worker.close();
await queue.close();
console.log("🎉 your first ChasquiMQ job ran end-to-end");

Run it:

Terminal window
npx tsx hello.ts
# [worker] sending email to ada@example.com
# 🎉 your first ChasquiMQ job ran end-to-end

That is your first job round-tripping through Redis Streams.

  • Queue.add(name, data) XADDs a MessagePack-encoded entry onto a Redis Stream named {chasqui:emails}.
  • The Worker reads the entry with XREADGROUP, deserializes the payload, runs your handler, and acks via XACKDEL (atomic ack-and-delete in one round trip).
  • No JSON. No LPUSH/BRPOP. No per-job round trips when you batch.