# Hanzo MQ — Hanzo AI

> BullMQ-compatible job queue with scheduling, rate limiting, priorities, retries, and dead letter queues.

Job queue

# Hanzo MQ

Background work, done later

MQ is a TypeScript library, not a server to run. Import it and your jobs live as data structures in Hanzo KV: add one here, and a worker in another process picks it up — with priorities, delays, retries with backoff, a rate limit per queue, and parent jobs that wait on their children. Every state change is a Lua script running inside the store, so two workers never take the same job.

Library

No broker to run

Cron

Scheduling

Retries

With backoff

At-least-once

Delivery

[Get Started](https://docs.hanzo.ai/docs/services/mq)[GitHub](https://github.com/hanzoai)

## The queue is data, the workers are yours

Nothing sits in the middle deciding. The state is in Hanzo KV and your processes race for it, safely.

### Scheduling

A cron expression, a delay in milliseconds, or a job that repeats on an interval — timezone aware, and held in the store rather than in a process that might restart.

### Rate Limiting

Cap how many jobs a queue may start in a window, and how many a single worker runs at once. The third-party API with a quota stops being the reason your service falls over.

### Priority Queues

A job carries a priority, so the urgent one goes ahead of the backlog. Inside one priority it stays first in, first out, which is what keeps ordinary work from quietly starving.

### Retry & Backoff

Set attempts and a backoff — fixed, exponential, or a function you write. A worker that dies mid-job loses its lock and the job is handed to another, so work is attempted at least once and can be attempted twice. Write it to be idempotent and that is a property rather than a surprise.

### Watch it happen

QueueEvents streams completed, failed, progress and stalled as they occur, so a job&#x27;s life is something you observe rather than reconstruct from logs afterwards.

### Failure is a state, not a deletion

A job that runs out of attempts lands in the failed set carrying its error and stack. Read it, fix the cause, retry it. Nothing disappears because it went wrong.

## Add a job here, run it there

worker.ts

```
import { Queue, Worker } from "@hanzo/mq" const queue = new Queue("emails", { connection: { host: "kv.hanzo.ai", port: 6379 } }) // Add jobs with options await queue.add("welcome", { userId: "usr_123" }, { priority: 1, delay: 5000, attempts: 3, backoff: { type: "exponential", delay: 1000 }, }) // Process jobs const worker = new Worker("emails", async (job) => { await sendEmail(job.data.userId, "welcome") }, { connection: { host: "kv.hanzo.ai", port: 6379 }, concurrency: 10, limiter: { max: 100, duration: 60_000 }, })
```

Open Source Revenue Sharing

### Up to 5% of compute goes back to open source

Every deployment is SBOM-verified. Contributors to BullMQ earn a share of compute revenue — transparent, on-chain, and customizable by the community.

[Connect & Earn](https://hanzo.ai/open-source/dividends)[Learn More](https://hanzo.ai/open-source)

Open Source Compute Dividends

### Up to 5% of compute goes back to OSS authors

Every Hanzo deployment tracks software dependencies via SBOM. When your code powers compute on Hanzo, the authors get paid — automatically.

USDHanzo NetworkETHSOLUSDCmore

[Connect GitHub](https://console.hanzo.ai?ref=oss-dividends)[How payouts work](https://hanzo.ai/open-source/dividends)

## Add a job and walk away

Free tier includes 10K jobs/month. No job size limits.

[Get Started](https://docs.hanzo.ai/docs/services/mq)[View on GitHub](https://github.com/hanzoai)

## Open source

License: Apache-2.0[hanzoai](https://github.com/hanzoai)

## Get MQ

Message queue

[Deploy to Cloud](https://console.hanzo.ai/deploy)[Self-host](https://docs.hanzo.ai/docs/services/mq)
