EB

egeominotti/bunqueue

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

590 stars 17 forks 质量 87 趋势 41MIT

⚡ Bun 的高性能作业队列。默认是 SQLite,扩展时支持 PostgreSQL 多代理。DLQ、cron、SQLite S3 备份和原生 MCP。没有 Redis。

概览

Bun 的高性能作业队列。内存或单文件 SQLite;扩展时使用 PostgreSQL 15–18 多代理。DLQ、cron、SQLite S3 备份和原生 MCP。为 AI 代理和自动化打造。没有 Redis。 文档 · 快速入门 · 基准测试 · npm 就这些。队列 + Worker 在一个对象里,持久化为单个 SQLite 文件。没有 Redis,没有配置,没有设置。msgpackr 是唯一的运行时依赖;cron、SQLite、S3、HTTP 和 WebSocket 都用 Bun 内置的。 队列也作为独立服务器运行。内存是零配置的默认配置;SQLite是零基础设施持久选项: 对于多个活跃代理,仓库包含一个固定在 PostgreSQL 18.6 上的拓扑: 它会针对一个数据库/命名空间启动两个代理。PostgreSQL 仅支持服务器;嵌入式模式继续使用内存/SQLite。密码变更时提供两个 Compose 值,仅在 URL 中编码保留字符百分比。MySQL 不支持

概述(AI 翻译)

Bun 的高性能作业队列。内存或单文件 SQLite;扩展时使用 PostgreSQL 15–18 多代理。 DLQ、cron、SQLite S3备份和原生MCP。为AI代理和自动化打造。没有Redis。

文献资料· 快速入门 · 视频课程· 基准测试 · NPM


快速开始

你的第一个工作大约一分钟后开始。在Bun上,队列会在你的应用里运行,没有 服务器起始:

就是这样:没有Redis,没有配置,没有设置。工人一直在等待更多工作 直到你用 Ctrl+C 停止它。示例中会将作业保留在内存中;传递 dataPath: './jobs.db' 到队列,工作者则在一个队列中持久化它们 SQLite 文件。msgpackr 是唯一的运行时依赖;cron、SQLite、S3、HTTP 和 WebSocket 使用了 Bun 内置的软件。

不是在Bun上?运行服务器,从任何地方连接

用 Docker 启动服务器(不需要 Bun),或者如果安装了 Bun,也可以用 bunx bunqueue start --host 127.0.0.1 --data-path ./bunqueue.db:

然后,在另一个终端中添加一个作业,并从Node.js处理:

Deno、Python、PHP、Go、Rust 和 Elixir 都遵循同样的三个步骤:参见 每种语言的快速入门。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

High-performance job queue for Bun. Memory or one-file SQLite; PostgreSQL 15–18 multi-broker when you scale. DLQ, cron, SQLite S3 backups, and native MCP. Built for AI agents and automation. No Redis.

Documentation · Quick Start · Video course · Benchmarks · npm


Quickstart

Your first job in about a minute. On Bun the queue runs inside your app, with no server to start:

bun add bunqueue
// jobs.ts
import { Queue, Worker } from 'bunqueue/client';

const queue = new Queue('emails', { embedded: true });

const worker = new Worker(
  'emails',
  async (job) => {
    console.log('Processing:', job.data.to);
    return { sent: true };
  },
  { embedded: true }
);

worker.on('error', (error) => console.error(error));
await queue.add('welcome', { to: '[email protected]' });
bun jobs.ts
# Processing: [email protected]

That’s it: no Redis, no config, no setup. The worker keeps waiting for more jobs until you stop it with Ctrl+C. The example keeps jobs in memory; pass dataPath: './jobs.db' to the queue and the worker to persist them in one SQLite file. msgpackr is the only runtime dependency; cron, SQLite, S3, HTTP and WebSocket use Bun’s built-ins.

Not on Bun? Run the server, connect from anywhere

Start the server with Docker (no Bun needed) or, if Bun is installed, with bunx bunqueue start --host 127.0.0.1 --data-path ./bunqueue.db:

docker run -d --name bunqueue \
  --restart unless-stopped \
  -p 127.0.0.1:6789:6789 \
  -p 127.0.0.1:6790:6790 \
  -v bunqueue-data:/app/data \
  egeominotti/bunqueue:alpine

curl --fail http://127.0.0.1:6790/health
在 GitHub 查看完整 README

安装

docker run -d --name bunqueue \
新手?先看 mcpskill.org 教程 →

配置

// Claude Desktop / Cursor / Windsurf { "mcpServers": { "bunqueue": { "command": "bunx", "args": ["--package=bunqueue", "bunqueue-mcp"], "env": { "BUNQUEUE_MCP_PROFILE": "agent" } } } }