npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rabbitmq-forward-control

v0.1.1

Published

Next.js console for RabbitMQ HTTP ingest, DingTalk forward, and local file logs. The published package includes a prebuilt .next; run the CLI without building.

Readme

rabbitmq-forward-control

基于 Next.js 的 RabbitMQ 控制台:HTTP 投递到交换机、多实例消费并转发钉钉机器人、本地文件日志与统计图表。

最简使用(从 npm 安装,无需 build)

发布到 npm 的包里已包含 next build 产物(.next),安装后直接启动即可:

npm install -g rabbitmq-forward-control
cd /你想存放 data 与 logs 的目录    # 默认为当前目录,也可用 config 里写 home
rabbitmq-forward-control --config ./config.json

等价写法(参数全部打在命令行上):

rabbitmq-forward-control -p 3847 --rabbitmq-url 'amqp://...' --forwarders ./forwarders.json

浏览器打开 http://<host>:<port>/console

配置方式(仅命令行)

所有业务配置只通过本包的命令行入口或 --config JSON 提供。
启动时 CLI 会把有效配置写入安装目录下的 .rmq-forward.runtime.json,服务进程只读该文件不读取 RMQ_* 等业务环境变量。

  • --home:数据根目录(其下自动使用 data/logs/)。不传则默认为你执行命令时的当前工作目录pwd)。
  • HTTP 端口:仅用 -p / -H 传给 Next,不依赖 PORT/HOST 环境变量(可不设置)。

未通过本 CLI 启动时(例如直接在包内运行 next dev),若不存在 .rmq-forward.runtime.json,则会回退读取 data/settings.jsondata/forwarders.json,便于本地改代码调试。

安装

npm install -g rabbitmq-forward-control

或在项目中:

npm install rabbitmq-forward-control

全局安装后,命令名为 rabbitmq-forward-control;在项目中可通过 npx rabbitmq-forward-control 调用。

启动参数说明

希望作为数据根目录的路径下执行命令(不设 --home 时,该目录即 home,下面会有 data/logs/):

cd /opt/rmq-forward-data

rabbitmq-forward-control \
  -p 3847 \
  -H 0.0.0.0 \
  --rabbitmq-url 'amqp://用户:密码@主机:5672/%2F' \
  --exchange 'rmq.forward.topic' \
  --exchange-type topic \
  --forwarders ./forwarders.json \
  --ingest-token 'your-secret-token'

也可只使用配置文件:rabbitmq-forward-control --config ./config.json

config.json 示例

{
  "port": 3847,
  "host": "0.0.0.0",
  "home": "/opt/rmq-forward-data",
  "rabbitmqUrl": "amqp://guest:[email protected]:5672",
  "exchange": "rmq.forward.topic",
  "exchangeType": "topic",
  "ingestToken": "",
  "connectTimeoutMs": 12000,
  "logRetentionDays": 7,
  "forwarders": [
    {
      "id": "f1",
      "name": "告警群",
      "queue": "ding.alerts",
      "webhookUrl": "https://oapi.dingtalk.com/robot/send?access_token=xxx",
      "enabled": true
    }
  ]
}

优先级:命令行里显式写的参数覆盖 config.json 里同名字段。

forwarders.json(数组)示例

与控制台「转发端」一致;webhookUrl 须为 https://oapi.dingtalk.com/.../robot/send

[
  {
    "id": "f1",
    "name": "告警群",
    "queue": "your.queue.name",
    "webhookUrl": "https://oapi.dingtalk.com/robot/send?access_token=xxx",
    "enabled": true
  }
]

配合 CLI:--forwarders ./forwarders.json

开发模式

rabbitmq-forward-control dev --config ./config.json

控制台与 HTTP 接口

启动后浏览器访问:http://<host>:<port>/console

  • 接收端POST /api/ingest,Body:{"topic":"<routing key>","body":"..."};若配置了 ingestToken,需头 Authorization: Bearer <ingestToken>

发布到 npm(维护者)

推荐在包目录一键脚本:默认自动 npm version patch(不写 git tag),再 npm run build,最后 npm publish --access public(其余参数会接在末尾)。

cd packages/rabbitmq-forward-control
./publish.sh                 # patch 升版 + 构建 + 发布(需已 npm login)
./publish.sh minor           # minor 升版
./publish.sh --no-bump       # 不升版,按当前 version 构建并发布
./publish.sh --dry-run       # 升版 + 构建 + 模拟发布
./publish.sh patch --tag beta
./publish.sh --help          # 查看说明

可选环境变量 NPM_PUBLISH_REGISTRY:设置后会追加 --registry <url>

若手动发布:在包目录执行 npm publish 时,prepublishOnly 也会先 npm run build,打进的 tarball 含完整 .next
请勿使用 npm publish --ignore-scripts,否则可能发出缺少 .next 的坏包。

本仓库源码本地调试时,才需要在包目录执行 npm run buildnpm run dev

自检(可选)

服务起来后可用接口探活,例如:

curl -sS "http://127.0.0.1:3847/api/console/stats"

克隆本仓库开发时可在包目录执行:npm run verify:http

安全说明

  • .rmq-forward.runtime.json 含敏感信息,勿提交到版本库(本仓库 .gitignore 已忽略)。
  • 生产环境建议配合防火墙仅开放必要端口,并为 /api/ingest 配置强 ingestToken