bull-mq

作为 BullMQ 专家,帮助开发者构建基于 Redis 的高性能 Node.js 任务队列与可靠的后台处理系统。支持延迟任务、速率限制、优先级设置、可重复的 cron 任务、任务依赖、并发控制与死信处理,适用于邮件发送、图像处理、Webhook 交付、报告生成和其他异步工作负载。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "bull-mq":https://skillpi.com/zh/skills/deepskill-66d02861e714d436a8b23f600f96b8bf29bace3a79f74c8bd4ecb16697b18219。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

作为 BullMQ 专家,帮助开发者构建基于 Redis 的高性能 Node.js 任务队列与可靠的后台处理系统。支持延迟任务、速率限制、优先级设置、可重复的 cron 任务、任务依赖、并发控制与死信处理,适用于邮件发送、图像处理、Webhook 交付、报告生成和其他异步工作负载。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: bull-mq
description: >-
  You are an expert in BullMQ, the high-performance job queue for Node.js
  built on Redis. You help developers build reliable background processing
  systems with delayed jobs, rate limiting, prioritization, repeatable cron
  jobs, job dependencies, concurrency control, and dead-letter handling —
  powering email sending, image processing, webhook delivery, report
  generation, and any async workload.
license: Apache-2.0
compatibility: ''
metadata:
  author: terminal-skills
  version: 1.0.0
  category: Backend Development
  tags:
    - queue
    - redis
    - jobs
    - background
    - worker
    - cron
    - node

BullMQ — Redis-Based Job Queue for Node.js

You are an expert in BullMQ, the high-performance job queue for Node.js built on Redis. You help developers build reliable background processing systems with delayed jobs, rate limiting, prioritization, repeatable cron jobs, job dependencies, concurrency control, and dead-letter handling — powering email sending, image processing, webhook delivery, report generation, and any async workload.

Core Capabilities

Queue and Worker

import { Queue, Worker, QueueScheduler, FlowProducer } from "bullmq";
import IORedis from "ioredis";

const connection = new IORedis({ host: "localhost", port: 6379, maxRetriesPerRequest: null });

// Define queue
const emailQueue = new Queue("email", { connection });

// Add jobs
await emailQueue.add("welcome", {
  to: "user@example.com",
  template: "welcome",
  data: { name: "Alice" },
}, {
  priority: 1,                            // Lower = higher priority
  attempts: 3,                            // Retry up to 3 times
  backoff: { type: "exponential", delay: 2000 },
  removeOnComplete: { count: 1000 },      // Keep last 1000 completed
  removeOnFail: { age: 7 * 24 * 3600 },   // Keep failed for 7 days
});

// Delayed job
await emailQueue.add("reminder", { userId: 42 }, {
  delay: 24 * 60 * 60 * 1000,            // 24 hours from now
});

// Repeatable (cron)
await emailQueue.add("digest", {}, {
  repeat: { pattern: "0 9 * * 1" },       // Every Monday at 9 AM
});

// Worker
const worker = new Worker("email", async (job) => {
  switch (job.name) {
    case "welcome":
      await sendEmail(job.data.to, job.data.template, job.data.data);
      break;
    case "reminder":
      await sendReminderEmail(job.data.userId);
      break;
    case "digest":
      await sendWeeklyDigest();
      break;
  }

  // Progress reporting
  await job.updateProgress(100);
  return { sent: true, timestamp: Date.now() };
}, {
  connection,
  concurrency: 5,                         // Process 5 jobs simultaneously
  limiter: { max: 100, duration: 60000 }, // Rate limit: 100 jobs/min
});

worker.on("completed", (job, result) => console.log(`Job ${job.id} completed`));
worker.on("failed", (job, err) => console.error(`Job ${job?.id} failed: ${err.message}`));

Job Flows (Parent-Child Dependencies)

const flow = new FlowProducer({ connection });

await flow.add({
  name: "generate-report",
  queueName: "reports",
  data: { reportId: "monthly-2026-03" },
  children: [
    { name: "fetch-sales", queueName: "data", data: { source: "sales" } },
    { name: "fetch-users", queueName: "data", data: { source: "users" } },
    { name: "fetch-metrics", queueName: "data", data: { source: "metrics" } },
  ],
  // Parent job runs only after ALL children complete
});

Installation

npm install bullmq ioredis

Best Practices

  1. Separate workers — Run workers in separate processes/containers from your API; scale independently
  2. Idempotent jobs — Design jobs to be safely retried; use unique job IDs to prevent duplicates
  3. Backoff strategy — Use exponential backoff for retries; prevents thundering herd on downstream failures
  4. Rate limiting — Use limiter to respect API rate limits (email providers, webhooks, external APIs)
  5. Progress tracking — Use job.updateProgress() for long-running jobs; clients can poll progress
  6. Graceful shutdown — Call worker.close() on SIGTERM; finishes current jobs before exiting
  7. Flows for pipelines — Use FlowProducer for job dependencies; parent waits for all children to complete
  8. Monitor with Bull Board — Use @bull-board/express for a web UI showing queue status, job data, and failures

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值88/100

亮点

  • 提供 BullMQ 完整技术栈支持,解决 Node.js 后台任务队列核心痛点
  • 覆盖延迟任务、速率限制、优先级、cron、依赖、并发、死信等关键能力
  • 有明确应用场景(邮件、图像处理、Webhook、报告生成)
触发精准92/100

亮点

  • description 完整描述 Skill 能力边界
  • 覆盖 BullMQ 核心概念(queue, worker, redis, jobs, cron 等)
  • 触发词精准,无明显歧义或重叠
结构规范95/100

亮点

  • 有清晰 Phase 划分(Core Capabilities, Installation, Best Practices)
  • 包含端到端代码示例
  • frontmatter 完整(name, description, license, metadata)
  • 单文件约 400 行,符合规范
执行可靠90/100

亮点

  • 工具来源明确(bullmq, ioredis)
  • 参数使用正确(priority, attempts, backoff, limiter 等)
  • 覆盖主要异常处理(retry, backoff, graceful shutdown)
  • 不可逆操作有确认机制(removeOnComplete/removeOnFail)
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 114 行

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。