https://github.com/weyoss/redis-smq
A simple high-performance Redis message queue for Node.js.
https://github.com/weyoss/redis-smq
broker job-queue message-broker message-queue nodejs priority-queue queue redis redis-smq scheduler
Last synced: about 22 hours ago
JSON representation
A simple high-performance Redis message queue for Node.js.
- Host: GitHub
- URL: https://github.com/weyoss/redis-smq
- Owner: weyoss
- License: mit
- Created: 2017-07-05T14:42:32.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-04-22T17:00:42.000Z (2 days ago)
- Last Synced: 2025-04-23T19:25:07.743Z (about 22 hours ago)
- Topics: broker, job-queue, message-broker, message-queue, nodejs, priority-queue, queue, redis, redis-smq, scheduler
- Language: TypeScript
- Homepage:
- Size: 8.28 MB
- Stars: 609
- Watchers: 9
- Forks: 64
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nodejs - RedisSMQ - Simple high-performance Redis message queue with real-time monitoring.  (Repository / Job Queues)
- awesome-message-queue - RedisSMQ - smq) |  |  |  |  | (Message Queue Middlewares)
- awesome-nodejs - RedisSMQ - Simple high-performance Redis message queue with real-time monitoring. (Packages / Job queues)
- awesome-node - RedisSMQ - Simple high-performance Redis message queue with real-time monitoring. (Packages / Job queues)
- awesome-nodejs-cn - RedisSMQ - 具有实时监控功能的简单高性能Redis消息队列. (目录 / 任务队列)
- awesome-nodejs-cn - RedisSMQ - **star:605** 简单的高性能Redis消息队列与实时监控 (包 / 工作队列)
- awesome-nodejs-cn - RedisSMQ - 具有实时监控功能的简单高性能 edis 消息队列 (包 / 任务队列)
README
[](https://github.com/weyoss/redis-smq)
A High-Performance Redis Simple Message Queue for Node.js
[](https://github.com/weyoss/redis-smq/actions/workflows/tests.yml)
[](https://github.com/weyoss/redis-smq/actions/workflows/codeql.yml)
[](https://github.com/weyoss/redis-smq/releases)
**What's New**
✨ V8 is here! Major architecture improvements, Pub/Sub delivery model, worker threads, enhanced TypeScript support, and more. [See release notes](release-notes/release-v8.md).
**Key Features**
- 🚀 [High-performance message processing](packages/redis-smq/docs/performance.md)
- 🔄 [Flexible producer/consumer model with multi-queue producers and consumers](packages/redis-smq/docs/consuming-messages.md)
- 🔀 [Different exchange types (Direct, Topic, FanOut) for publishing messages to one or multiple queues](packages/redis-smq/docs/message-exchanges.md)
- 📬 [Two delivery models (Point-2-Point and Pub/Sub)](packages/redis-smq/docs/queue-delivery-models.md) with reliable delivery and configurable retry modes
- 📊 [Three queuing strategies (FIFO, LIFO, Priority Queues)](packages/redis-smq/docs/queues.md)
- 🧵 [Message handler worker threads for sandboxing and performance improvement](packages/redis-smq/docs/message-handler-worker-threads.md)
- ⏱️ [Message expiration and consumption timeout](packages/redis-smq/docs/messages.md)
- 🚦 [Queue rate limiting for controlling message consumption rates](packages/redis-smq/docs/queue-rate-limiting.md)
- 🕰️ [Built-in scheduler for delayed message delivery and repeating messages](packages/redis-smq/docs/scheduling-messages.md)
- 🌐 [RESTful API](packages/redis-smq-rest-api/README.md) and [Web UI](packages/redis-smq-web-ui/README.md) for interacting with the message queue
- 📦 [Support for ESM and CJS modules](packages/redis-smq/docs/esm-cjs-modules.md)**Use Cases**
- Managing background tasks, such as email sending or data processing.
- Efficiently scheduling and retrying tasks.
- Communication between multiple services in microservices architectures.
- Handling real-time events in gaming, IoT, or analytics systems.**Installation**
To get started with RedisSMQ, you can install the library using npm:
```bash
npm i redis-smq@latest redis-smq-common@latest --save
```Don't forget to install a Redis client. Choose either node-redis or ioredis:
```shell
npm install @redis/client --save
# or
npm install ioredis --save
```**Configuration**
Set up the RedisSMQ configuration during your application bootstrap:
```javascript
'use strict';
const { Configuration } = require('redis-smq');
const { ERedisConfigClient } = require('redis-smq-common');const config = {
redis: {
// Using ioredis as the Redis client
client: ERedisConfigClient.IOREDIS,
// Add any other ioredis options here
options: {
host: '127.0.0.1',
port: 6379,
},
},
};Configuration.getSetConfig(config);
```**Usage**
Here's a basic example to create a queue, produce a message, and consume it:
```javascript
// Creating a queue
const queue = new Queue();
queue.save('my_queue', EQueueType.LIFO_QUEUE, EQueueDeliveryModel.POINT_TO_POINT, (err) => {
if (err) console.error(err);
});// Producing a message
const msg = new ProducibleMessage();
msg.setQueue('my_queue').setBody('Hello Word!');
producer.produce(msg, (err, ids) => {
if (err) console.error(err);
else console.log(`Produced message IDs are: ${ids.join(', ')}`);
});// Consuming a message
const consumer = new Consumer();
const messageHandler = (msg, cb) => {
console.log(msg.body);
cb(); // Acknowledging
};
consumer.consume('my_queue', messageHandler, (err) => {
if (err) console.error(err);
});
```
**Documentation**For more information, visit the [RedisSMQ Docs](packages/redis-smq/docs/README.md).
**Contributing**
Interested in contributing to this project? Please check out our [CONTRIBUTING.md](CONTRIBUTING.md).
**License**
RedisSMQ is released under the [MIT License](https://github.com/weyoss/redis-smq/blob/master/LICENSE).