# JavaScript message queue libraries

JavaScript message queue libraries connect an application to a message broker or managed queue service. A producer publishes each message to a topic or queue before a consumer reads and acknowledges it on its own schedule. These libraries let backend services and agent workers hand off jobs, events, and device data without waiting on each other.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [ioredis](#ioredis) | 165.9M | 15.4K | Jul 2026 | MIT |
| [@aws-sdk/client-sqs](#aws-sdk-client-sqs) | 77.0M | 3.7K | Nov 2026 | Apache-2.0 |
| [@google-cloud/pubsub](#google-cloud-pubsub) | 41.2M | 551 | Nov 2026 | Apache-2.0 |
| [KafkaJS](#kafkajs) | 19.3M | 4.0K | Feb 2023 | MIT |
| [amqplib](#amqplib) | 16.5M | 3.8K | Nov 2026 | MIT |
| [MQTT.js](#mqtt-js) | 14.6M | 9.1K | Oct 2026 | MIT |
| [@nats-io/transport-node](#nats-node-transport) | 3.8M | 455 | Nov 2026 | Apache-2.0 |
| [Azure Service Bus](#azure-service-bus) | 3.6M | 2.3K | Oct 2026 | MIT |

Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[ioredis](#ioredis) has the most monthly downloads in this comparison, at 165.9M, a count that covers every Redis operation rather than messaging alone.

## Capabilities

| Library | Publish batching | Browser client |
| --- | --- | --- |
| [ioredis](#ioredis) | Yes | No |
| [@aws-sdk/client-sqs](#aws-sdk-client-sqs) | Yes | Yes |
| [@google-cloud/pubsub](#google-cloud-pubsub) | Yes | No |
| [KafkaJS](#kafkajs) | Yes | No |
| [amqplib](#amqplib) | No | No |
| [MQTT.js](#mqtt-js) | No | Yes |
| [@nats-io/transport-node](#nats-node-transport) | No | No |
| [Azure Service Bus](#azure-service-bus) | Yes | Yes |

## Libraries

### ioredis

[GitHub](https://github.com/redis/ioredis) · [npm](https://www.npmjs.com/package/ioredis) · [Docs](https://github.com/redis/ioredis/blob/main/README.md)

Provides a full-featured Redis client for Node.js.

- Downloads / mo: 165.9M
- Stars: 15.4K
- Last release: 6.0.0
- License: MIT
- Capabilities: [From the ioredis docs](https://github.com/redis/ioredis/blob/main/README.md)

```sh
npm install ioredis
```

**nestjs/nest** (77.3K stars)

[nestjs/nest](https://github.com/nestjs/nest) 

```javascript
public async bindEvents(subClient: Redis, pubClient: Redis): Promise<void> {
  subClient.on(
    this.options?.wildcards ? 'pmessage' : 'message',
    this.getMessageHandler(pubClient).bind(this),
  );
  const subscribePatterns = [...this.messageHandlers.keys()];
  // Awaited so that a rejected subscription (e.g., an ACL without access to
  // the channel) fails `listen()` instead of going unhandled.
  await Promise.all(
    subscribePatterns.map(pattern => {
      const { isEventHandler } = this.messageHandlers.get(pattern)!;

      const channel = isEventHandler
        ? pattern
        : this.getRequestPattern(pattern);

      return this.options?.wildcards
        ? subClient.psubscribe(channel)
        : subClient.subscribe(channel);
    }),
  );
}

```

[packages/microservices/server/server-redis.ts](https://github.com/nestjs/nest/blob/f5a561a6de90fdb2954b8072d256f03b5a082af2/packages/microservices/server/server-redis.ts#L89-L110) · [More projects using ioredis →](https://dashboard.exa.ai/playground/search?q=ioredis%20GitHub%20projects)

**Quickstart**

```javascript
import Redis from 'ioredis';

const redis = new Redis('redis://localhost:6379');
await redis.publish('events', 'Hello world!');
redis.disconnect();

```

From [README.md](https://github.com/redis/ioredis/blob/main/README.md)

### @aws-sdk/client-sqs

[GitHub](https://github.com/aws/aws-sdk-js-v3) · [npm](https://www.npmjs.com/package/@aws-sdk/client-sqs) · [Docs](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-sqs/README.md)

Provides the AWS SDK client for Amazon SQS in Node.js, browsers, and React Native.

- Downloads / mo: 77.0M
- Stars: 3.7K
- Last release: 3.1172.0
- License: Apache-2.0
- Capabilities: [From the @aws-sdk/client-sqs docs](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-sqs/README.md)

```sh
npm install @aws-sdk/client-sqs
```

**Helicone/helicone** (6.3K stars)

[Helicone/helicone](https://github.com/Helicone/helicone) 

```javascript
async getQueueSize(): Promise<number | null> {
  const command = new GetQueueAttributesCommand({
    QueueUrl: this.queueUrl,
    AttributeNames: ["ApproximateNumberOfMessages"],
  });
  const response = await this.sqs.send(command);
  return response.Attributes?.ApproximateNumberOfMessages
    ? Number(response.Attributes.ApproximateNumberOfMessages)
    : null;
}

```

[helicone-heartbeat/src/clients/SqsClient.ts](https://github.com/Helicone/helicone/blob/9254d10e5f11af76912f050e6198f274abc2f005/helicone-heartbeat/src/clients/SqsClient.ts#L42-L51) · [More projects using @aws-sdk/client-sqs →](https://dashboard.exa.ai/playground/search?q=%40aws-sdk/client-sqs%20GitHub%20projects)

**Quickstart**

```javascript
import { SQSClient, GetQueueAttributesCommand } from '@aws-sdk/client-sqs';

const client = new SQSClient({ region: process.env.AWS_REGION });
const result = await client.send(new GetQueueAttributesCommand({
  QueueUrl: process.env.SQS_QUEUE_URL,
  AttributeNames: ['ApproximateNumberOfMessages'],
}));

```

From [README.md](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-sqs/README.md)

### @google-cloud/pubsub

[GitHub](https://github.com/googleapis/nodejs-pubsub) · [npm](https://www.npmjs.com/package/@google-cloud/pubsub) · [Docs](https://googleapis.dev/nodejs/pubsub/6.4.1/PubSub.html)

Provides the Cloud Pub/Sub client library for Node.js.

- Downloads / mo: 41.2M
- Stars: 551
- Last release: 6.4.1
- License: Apache-2.0
- Capabilities: [From the @google-cloud/pubsub docs](https://googleapis.dev/nodejs/pubsub/6.4.1/PubSub.html)

```sh
npm install @google-cloud/pubsub
```

**googleworkspace/google-chat-samples** (609 stars)

[googleworkspace/google-chat-samples](https://github.com/googleworkspace/google-chat-samples) 

```javascript
const messageHandler = message => {
  console.log(`Id : ${message.id}`);
  const event = JSON.parse(message.data);
  console.log(`Data : ${JSON.stringify(event)}`);

  // Post the response to Google Chat.
  const request = formatRequest(event);
  if (request != null) {
    chat.createMessage(request);
  }

  // Ack the message.
  message.ack();
}

```

[node/pub-sub-app/index.js](https://github.com/googleworkspace/google-chat-samples/blob/62dd4336fb4062caedfb3d35bd9f8c19b07f7506/node/pub-sub-app/index.js#L37-L50) · [More projects using @google-cloud/pubsub →](https://dashboard.exa.ai/playground/search?q=%40google-cloud/pubsub%20GitHub%20projects)

**Quickstart**

```javascript
import { PubSub } from '@google-cloud/pubsub';

const pubsub = new PubSub();
const topic = pubsub.topic(process.env.PUBSUB_TOPIC);
const messageId = await topic.publishMessage({ data: Buffer.from('Hello world!') });
await pubsub.close();

```

From [Topic.html](https://googleapis.dev/nodejs/pubsub/6.4.1/PubSub.html)

### KafkaJS

[GitHub](https://github.com/tulios/kafkajs) · [npm](https://www.npmjs.com/package/kafkajs) · [Docs](https://kafka.js.org/docs/consuming)

Produces and consumes Apache Kafka messages from Node.js applications.

- Downloads / mo: 19.3M
- Stars: 4.0K
- Last release: 2.2.4
- License: MIT
- Capabilities: [From the KafkaJS docs](https://kafka.js.org/docs/consuming)

**Strengths**

- **Consumes whole message batches.** Use eachBatch to process batches and control offset resolution.
- **Pauses individual topic partitions.** Use pause to stop a topic-partition and resume it later.

**Watch out for**

- **Long handlers need heartbeats.** Increase sessionTimeout or send heartbeats during slow message processing.
- **Fatal errors stop consumer restarts.** Handle non-retriable errors outside restartOnFailure.

```sh
npm install kafkajs
```

**nestjs/nest** (77.3K stars)

[nestjs/nest](https://github.com/nestjs/nest) 

```typescript
public async bindEvents(consumer: Consumer) {
  const registeredPatterns = [...this.messageHandlers.keys()];
  const consumerSubscribeOptions = this.options.subscribe || {};

  if (registeredPatterns.length > 0) {
    await this.consumer!.subscribe({
      ...consumerSubscribeOptions,
      topics: registeredPatterns,
    });
  }

  const consumerRunOptions = {
    ...(this.options.run || {}),
    eachMessage: this.getMessageHandler(),
  };
  await consumer.run(consumerRunOptions);
}

```

[packages/microservices/server/server-kafka.ts](https://github.com/nestjs/nest/blob/085f83a168e9edbedfe9560428dcfd270073ae00/packages/microservices/server/server-kafka.ts#L253-L269) · [More projects using KafkaJS →](https://dashboard.exa.ai/playground/search?q=Established%20public%20JavaScript%20TypeScript%20applications%20using%20kafkajs%20native%20broker%20client%20message%20publishing%20consuming%20acknowledgement%20backpressure%20routing&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import { Kafka } from 'kafkajs';

const kafka = new Kafka({ clientId: 'example', brokers: ['localhost:9092'] });
const producer = kafka.producer();
await producer.connect();
await producer.send({ topic: 'events', messages: [{ value: 'Hello world!' }] });
await producer.disconnect();

```

From [README.md](https://kafka.js.org/docs/producing)

### amqplib

[GitHub](https://github.com/amqp-node/amqplib) · [npm](https://www.npmjs.com/package/amqplib) · [Docs](https://amqp-node.github.io/amqplib/channel_api.html)

Connects Node.js applications to AMQP brokers using channels, exchanges, and queues.

- Downloads / mo: 16.5M
- Stars: 3.8K
- Last release: 2.4.0
- License: MIT
- Capabilities: [From the amqplib docs](https://amqp-node.github.io/amqplib/channel_api.html)

**Strengths**

- **Offers broker confirmation callbacks.** Use ConfirmChannel callbacks to track server confirmations.
- **Recovers connections when enabled.** Configure recovery and recreate channels inside its setup callback.

**Watch out for**

- **Publishing needs backpressure handling.** Pause writes after false and resume on drain.
- **Supports AMQP 0-9-1 only.** Use another client for AMQP 1.0 brokers.

```sh
npm install amqplib
```

**moleculerjs/moleculer** (6.4K stars)

[moleculerjs/moleculer](https://github.com/moleculerjs/moleculer) 

```typescript
send(topic, data, { balanced, packet }) {
	/* istanbul ignore next*/
	if (!this.channel) return this.broker.Promise.resolve();

	if (packet.target != null || balanced) {
		this.channel.sendToQueue(topic, data, this.opts.messageOptions);
	} else {
		this.channel.publish(topic, "", data, this.opts.messageOptions);
	}

	return this.broker.Promise.resolve();
}

```

[src/transporters/amqp.js](https://github.com/moleculerjs/moleculer/blob/008129c32eebc1911b640b40e2da86e5c0bd936a/src/transporters/amqp.js#L488-L499) · [More projects using amqplib →](https://dashboard.exa.ai/playground/search?q=Established%20public%20JavaScript%20TypeScript%20applications%20using%20amqplib%20native%20broker%20client%20message%20publishing%20consuming%20acknowledgement%20backpressure%20routing&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import amqp from 'amqplib';

const connection = await amqp.connect('amqp://localhost');
const channel = await connection.createChannel();
await channel.assertQueue('jobs');
channel.sendToQueue('jobs', Buffer.from('Hello world!'));
await channel.close();
await connection.close();

```

From [README.md](https://amqp-node.github.io/amqplib/channel_api.html)

### MQTT.js

[GitHub](https://github.com/mqttjs/MQTT.js) · [npm](https://www.npmjs.com/package/mqtt) · [Docs](https://github.com/mqttjs/MQTT.js/blob/v5.16.1/README.md)

Publishes and subscribes to MQTT topics from Node.js and browsers.

- Downloads / mo: 14.6M
- Stars: 9.1K
- Last release: 5.16.1
- License: MIT
- Capabilities: [From the MQTT.js docs](https://github.com/mqttjs/MQTT.js/blob/v5.16.1/README.md)

**Strengths**

- **Runs in browsers.** Use the same MQTT library in Node.js and browser applications.
- **Processes messages with backpressure.** Override handleMessage to process messages one at a time.

**Watch out for**

- **Backpressure handlers must call back.** Call callback after handling a message to keep the client moving.
- **Refused connections need retry opt-in.** Enable reconnectOnConnackError to retry connections the broker actively denies.

```sh
npm install mqtt
```

**moleculerjs/moleculer** (6.4K stars)

[moleculerjs/moleculer](https://github.com/moleculerjs/moleculer) 

```typescript
subscribe(cmd, nodeID) {
	return new this.broker.Promise((resolve, reject) => {
		const topic = this.getTopicName(cmd, nodeID);
		this.client.subscribe(topic, { qos: this.qos }, (err, granted) => {
			if (err) return reject(err);

			this.logger.debug("MQTT server granted", granted);

			resolve();
		});
	});
}

```

[src/transporters/mqtt.js](https://github.com/moleculerjs/moleculer/blob/008129c32eebc1911b640b40e2da86e5c0bd936a/src/transporters/mqtt.js#L153-L164) · [More projects using MQTT.js →](https://dashboard.exa.ai/playground/search?q=Established%20public%20JavaScript%20TypeScript%20applications%20using%20mqtt%20native%20broker%20client%20message%20publishing%20consuming%20acknowledgement%20backpressure%20routing&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import mqtt from 'mqtt';

const client = await mqtt.connectAsync('mqtt://localhost');
await client.publishAsync('events', 'Hello world!');
await client.endAsync();

```

From [README.md](https://github.com/mqttjs/MQTT.js/blob/v5.16.1/README.md)

### @nats-io/transport-node

[GitHub](https://github.com/nats-io/nats.js) · [npm](https://www.npmjs.com/package/@nats-io/transport-node) · [Docs](https://github.com/nats-io/nats.js/blob/v3.5.0/transport-node/README.md)

Provides Node.js NATS connections and re-exports the core messaging APIs.

- Downloads / mo: 3.8M
- Stars: 455
- Last release: 3.5.0
- License: Apache-2.0
- Capabilities: [From the @nats-io/transport-node docs](https://github.com/nats-io/nats.js/blob/v3.5.0/transport-node/README.md)

**Strengths**

- **Distributes messages within queue groups.** Use a queue group to distribute messages among subscribers.
- **Drains messages before closing.** Drain the connection to finish subscriptions and send outbound messages.

**Watch out for**

- **JetStream needs another package.** Install and import the JetStream module for its additional APIs.
- **Callbacks cannot await message handling.** Use an async iterator or handle asynchronous work outside the callback.

```sh
npm install @nats-io/transport-node
```

**nestjs/nest** (77.3K stars)

[nestjs/nest](https://github.com/nestjs/nest) 

```typescript
public getPublisher(natsMsg: NatsMsg, id: string, ctx: NatsContext) {
  if (natsMsg.reply) {
    return (response: any) => {
      Object.assign(response, { id });
      const outgoingResponse: NatsRecord =
        this.serializer.serialize(response);

      return natsMsg.respond(outgoingResponse.data, {
        headers: outgoingResponse.headers,
      });
    };
  }

  // In case the "reply" topic is not provided, there's no need for a reply.
  // Method returns a noop function instead

  return () => {};
}

```

[packages/microservices/server/server-nats.ts](https://github.com/nestjs/nest/blob/f5a561a6de90fdb2954b8072d256f03b5a082af2/packages/microservices/server/server-nats.ts#L277-L294) · [More projects using @nats-io/transport-node →](https://dashboard.exa.ai/playground/search?q=Established%20public%20JavaScript%20TypeScript%20applications%20using%20%40nats-io/transport-node%20native%20broker%20client%20message%20publishing%20consuming%20acknowledgement%20backpressure%20routing&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```typescript
import { connect } from '@nats-io/transport-node';

const connection = await connect({ servers: 'nats://localhost:4222' });
connection.publish('events', new TextEncoder().encode('Hello world!'));
await connection.drain();

```

From [runtimes.md](https://github.com/nats-io/nats.js/blob/v3.5.0/transport-node/README.md)

### Azure Service Bus

[GitHub](https://github.com/Azure/azure-sdk-for-js) · [npm](https://www.npmjs.com/package/@azure/service-bus) · [Docs](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicebus/service-bus/README.md)

Provides the Azure Service Bus SDK for JavaScript.

- Downloads / mo: 3.6M
- Stars: 2.3K
- Last release: 7.10.0
- License: MIT
- Capabilities: [From the Azure Service Bus docs](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicebus/service-bus/README.md)

```sh
npm install @azure/service-bus
```

**microsoft/opensource-management-portal** (537 stars)

[microsoft/opensource-management-portal](https://github.com/microsoft/opensource-management-portal) 

```javascript
async deleteMessage(message: IQueueMessage): Promise<void> {
  if (!this.#initialized) {
    throw new Error('Provider not initialized');
  }
  if (this.#options.immediatelyDeleteMessages) {
    console.log(
      `In immediate delete mode, not deleting message ${message.identifier} (it was already handled)`
    );
    return;
  }
  const assumedType = message as ServiceBusMessage;
  const lockedMessage = assumedType.lockedMessage();
  try {
    await this.#receiver.completeMessage(lockedMessage);
  } catch (deleteError) {
    console.warn(`Delete error: ${deleteError}`);
    throw deleteError;
  }
}

```

[lib/queues/servicebus.ts](https://github.com/microsoft/opensource-management-portal/blob/a1c7f6e691e271936bf14557435b94f78857fe96/lib/queues/servicebus.ts#L133-L151) · [More projects using Azure Service Bus →](https://dashboard.exa.ai/playground/search?q=%40azure/service-bus%20GitHub%20projects)

**Quickstart**

```javascript
import { ServiceBusClient } from '@azure/service-bus';

const client = new ServiceBusClient(process.env.SERVICE_BUS_CONNECTION_STRING);
const sender = client.createSender(process.env.SERVICE_BUS_QUEUE);
await sender.sendMessages({ body: 'Hello world!' });
await sender.close();
await client.close();

```

From [README.md](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/servicebus/service-bus/README.md)

## FAQ

### Which JavaScript message queue library should I use?

The broker decides the library. [KafkaJS](#kafkajs) connects to Apache Kafka, [amqplib](#amqplib) to RabbitMQ and other AMQP brokers, and [MQTT.js](#mqtt-js) to MQTT brokers. Managed services have their own SDKs, such as the [AWS SDK SQS client](#aws-sdk-client-sqs) and [Google Cloud Pub/Sub](#google-cloud-pubsub).

### RabbitMQ vs Kafka: which should I use?

RabbitMQ routes messages through exchanges and queues with per-message acknowledgement, through [amqplib](#amqplib) in Node.js. Kafka keeps messages in partitioned logs that consumer groups read by offset, through [KafkaJS](#kafkajs).

### What is ioredis?

[ioredis](#ioredis) is a Redis client for Node.js with Pub/Sub and Streams commands. Redis Pub/Sub delivers messages without per-message acknowledgement.

### What is KafkaJS?

[KafkaJS](#kafkajs) is an Apache Kafka client for Node.js with producers, consumers, and consumer groups. Consumers track their progress through committed offsets.

### What is amqplib?

[amqplib](#amqplib) is a Node.js client for AMQP brokers such as RabbitMQ. It works with channels, exchanges, queues, routing keys, and optional publisher confirms.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best JavaScript message queue client libraries amqplib KafkaJS MQTT NATS code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
