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

rocketmq-sdk-ts

v0.1.1

Published

Pure TypeScript RocketMQ 4.x Remoting client with ACL and TLS

Readme

rocketmq-sdk-ts

纯 TypeScript 实现的 RocketMQ 4.x Remoting SDK,运行于 Node.js 和 Bun,支持 ACL 与 TLS, 不依赖 gRPC 或原生扩展。

提供同步 Producer 和集群模式 PushConsumer,包括 ACL、TLS、心跳、队列分配、 TAG 过滤、长轮询、消费进度提交和失败重投。

npm install rocketmq-sdk-ts
import { createProducer } from "rocketmq-sdk-ts";

const producer = createProducer({
  nameServers: ["rocketmq.example.com:9876"],
  accessKey: process.env.ROCKETMQ_ACCESS_KEY!,
  secretKey: process.env.ROCKETMQ_SECRET_KEY!,
  tls: true,
});

await producer.start();
const result = await producer.send({
  topic: "order_events",
  tag: "created",
  body: JSON.stringify({ event: "created" }),
});
await producer.close();
import { createPushConsumer } from "rocketmq-sdk-ts";

const consumer = createPushConsumer(
  {
    nameServers: ["rocketmq.example.com:9876"],
    accessKey: process.env.ROCKETMQ_ACCESS_KEY!,
    secretKey: process.env.ROCKETMQ_SECRET_KEY!,
    groupName: "GID_order_service_consumer",
    subscriptions: {
      order_events: "created || updated",
    },
    tls: true,
    maxAttempts: 3,
  },
  async (message) => {
    const payload = JSON.parse(message.body.toString("utf8"));
    await handleEvent(payload);
    return "success";
  },
);

await consumer.start();
process.once("SIGTERM", () => void consumer.close());

消费处理器返回 "retry" 或抛出异常时,消息会重投并按 Broker 的重试策略再次投递。 同一 groupName 的多个实例会自动平均分配队列。不同业务应使用不同的消费组前缀。 使用云托管 RocketMQ 时,需要先在控制台创建对应的消费组。

tls 默认启用。为兼容 RocketMQ 4.x 服务端自签名证书,默认不校验证书链; 提供可信 CA 后可传 tls: { rejectUnauthorized: true, ca } 开启校验。 只有服务端明确未启用 TLS 时才传 tls: false。