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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mqueue/queue

v1.0.1

Published

A simple queue interface with support for multiple backends

Downloads

267

Readme

mqueue (Multi-Queue)

Simple queue interface with support for multiple backends. Keep your options open.

Installation

Install MQueue and select adapters:

# Install MQueue:
npm install --save @mqueue/queue # + Adapter(s)...
# or use pnpm/yarn

# Install some adapters
npm install --save @mqueue/amqplib
npm install --save @mqueue/azure-service-bus
npm install --save @mqueue/google-cloud-pubsub
npm install --save @mqueue/rhea
npm install --save @mqueue/sqs
npm install --save @mqueue/mqtt
npm install --save @mqueue/kafkajs
npm install --save @mqueue/stompjs
npm install --save @mqueue/fastq
import MQueue from "@mqueue/queue"; // or require("@mqueue/queue");

const outgoingQueue = new MQueue.Outgoing(
  await AmqplibOutgoingQueue.connect("amqp://rabbitmq:5271", "queue-name"),
);

// Send a message to the queue
outgoingQueue.sendMessage({
  headers: {
    "Account-ID": "123",
  },
  body: "...",
});

// ...

const incomingQueue = new MQueue.Incoming(
  await AmqplibIncomingQueue.connect("amqp://rabbitmq:5271", "queue-name"),
);

// Start listening to the queue
await incomingQueue.consume(async (payload) => {
  const topicOrQueueName = payload.transport.name;
  const headers = payload.message.headers;
  const data = await payload.message.json();
  await payload.accept(); // or await payload.reject();
  // ...
});

Queue Adapters

Broadcast Strategies

Compatibility

Why might you need a Message Queue?

  • NodeJS v18+, tested on v22+

| Queue Platform | Queue Adapter | | --------------------------------------------- | --------------------------------- | | Apache ActiveMQ (AMQP v1.0) | @mqueue/rhea | | Apache ActiveMQ (MQTT) | @mqueue/mqtt | | Apache ActiveMQ (STOMP) | @mqueue/stompjs | | Apache Kafka | @mqueue/kafkajs | | AWS Simple Queue Service (SQS) | @mqueue/sqs | | Azure Service Bus | @mqueue/azure-service-bus | | Azure Service Bus (AMQP v1.0) [^1] | @mqueue/rhea | | Eclipe Mosquitto | @mqueue/mqtt | | ElasticMQ (SQS-Compatible) | @mqueue/sqs | | EMQX (MQTT) | @mqueue/mqtt | | Fastq | @mqueue/fastq | | Google Cloud Pub/Sub | @mqueue/google-cloud-pubsub | | HiveMQ (MQTT) | @mqueue/mqtt | | RabbitMQ (AMQP v0.9.1) | @mqueue/amqplib | | RabbitMQ (AMQP v1.0 or with AMQP v1.0 Plugin) | @mqueue/rhea | | RabbitMQ (with MQTT Plugin) | @mqueue/mqtt | | RabbitMQ (with STOMP Plugin) | @mqueue/stompjs | | IBM MQ (AMQP v1.0) | @mqueue/rhea |

Examples

Instantiation:

// Example: Switching between AMQP v0.9.1 and SQS for development and production
const isProduction = process.env.NODE_ENV === "production";

const outgoingQueue = new MQueue.Outgoing(
  isProduction
    ? await SQSOutgoingQueue.connect("/queue1", {
        credentials: { accessKeyId: "x", secretAccessKey: "x" },
        region: "elasticmq", // or applicable AWS region for SQS
        endpoint: "http://elasticmq:9324",
      })
    : await AmqplibOutgoingQueue.connect("amqp://rabbitmq:5271", "queue-name"),
);

outgoingQueue.sendMessage({
  headers: {
    "Account-ID": "123",
  },
  body: "...",
});

// ...

const incomingQueue = new MQueue.Incoming(
  isProduction
    ? await SQSIncomingQueue.connect("/queue1", {
        credentials: { accessKeyId: "x", secretAccessKey: "x" },
        region: "elasticmq", // or applicable AWS region for SQS
        endpoint: "http://elasticmq:9324",
      })
    : await AmqplibIncomingQueue.connect("amqp://rabbitmq:5271", "queue-name"),
);

Hash Header Verification:

// Adding digital signature verification
import { SignatureHashHook } from "@mqueue/queue";

const outgoingQueue = new MQueue.Outgoing(
  await AmqplibOutgoingQueue.connect("amqp://rabbitmq:5271", "queue-name"),
  { onSend: [SignatureHashHook.outgoing()] },
);

outgoingQueue.sendMessage({
  headers: {
    "Account-ID": "123",
  },
  body: "...",
});

// ...

const incomingQueue = new MQueue.Incoming(
  await AmqplibIncomingQueue.connect("amqp://rabbitmq:5271", "queue-name"),
  { onReceipt: [SignatureHashHook.incoming()] },
);

License

MIT © Dom Webber

[^1]: Better authentication integration may be achieved with Azure Service bus by using @mqueue/azure-service-bus instead of @mqueue/rhea.