Exapedia / Tools / JavaScript message queue libraries JavaScript message queue libraries Updated Nov 2026
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 ioredis @aws-sdk/client-sqs @google-cloud/pubsub KafkaJS amqplib MQTT.js @nats-io/transport-node Azure Service Bus FAQ Popularity ioredis has the most monthly downloads in this comparison, at 165.9M , a count that covers every Redis operation rather than messaging alone.
Libraries and code examples Provides a full-featured Redis client for Node.js.
Downloads / mo 165.9M
Stars 15.4K
Last release 6.0.0
License MIT $ npm install ioredis Copy
import Redis from 'ioredis';
const redis = new Redis('redis://localhost:6379');
await redis.publish('events', 'Hello world!');
redis.disconnect();
ioredis examples From open-source projects on GitHub 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);
}),
);
}
Show full example 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 $ npm install @aws-sdk/client-sqs Copy
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'],
}));
@aws-sdk/client-sqs examples From open-source projects on GitHub 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;
}
Show full example 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 $ npm install @google-cloud/pubsub Copy
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();
@google-cloud/pubsub examples From open-source projects on GitHub 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();
}
Show full example Produces and consumes Apache Kafka messages from Node.js applications.
Downloads / mo 19.3M
Stars 4.0K
Last release 2.2.4
License MIT 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. Limitations Long handlers need heartbeats . Increase sessionTimeout or send heartbeats during slow message processing. Fatal errors stop consumer restarts . Handle non-retriable errors outside restartOnFailure. $ npm install kafkajs Copy
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();
KafkaJS examples From open-source projects on GitHub 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);
}
Show full example 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 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. Limitations 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. $ npm install amqplib Copy
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();
amqplib examples From open-source projects on GitHub 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();
}
Show full example 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 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. Limitations 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. $ npm install mqtt Copy
import mqtt from 'mqtt';
const client = await mqtt.connectAsync('mqtt://localhost');
await client.publishAsync('events', 'Hello world!');
await client.endAsync();
MQTT.js examples From open-source projects on GitHub 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();
});
});
}
Show full example 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 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. Limitations 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. $ npm install @nats-io/transport-node Copy
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();
@nats-io/transport-node examples From open-source projects on GitHub 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 () => {};
}
Show full example Provides the Azure Service Bus SDK for JavaScript.
Downloads / mo 3.6M
Stars 2.3K
Last release 7.10.0
License MIT $ npm install @azure/service-bus Copy
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();
Azure Service Bus examples From open-source projects on GitHub 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;
}
}
Show full example For coding agents
Found your message queue library? Help your agent use it. Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.
Claude Code Cursor Codex VS Code Devin Devin Desktop Gemini CLI OpenCode
Run in your terminal
claude plugin install exa@claude-plugins-official Copy Add to ~/.cursor/mcp.json
{
"mcpServers": {
"exa": {
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy Open in your browser, then install the Exa plugin
https://chatgpt.com/plugins/exa Copy Add to .vscode/mcp.json
{
"servers": {
"exa": {
"type": "http",
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy In Devin, open Customize, then MCPs, and add a custom HTTP server with this URL
https://mcp.exa.ai/mcp Copy Add to ~/.config/devin/mcp_config.json
{
"mcpServers": {
"exa": {
"serverUrl": "https://mcp.exa.ai/mcp"
}
}
} Copy Add to ~/.gemini/settings.json
{
"mcpServers": {
"exa": {
"httpUrl": "https://mcp.exa.ai/mcp"
}
}
} Copy Add to opencode.json
{
"mcp": {
"exa": {
"type": "remote",
"url": "https://mcp.exa.ai/mcp"
}
}
} Copy