π‘ Note: You are viewing the
nextbranch with upcoming features. For stable releases, check themasterbranch.
A high-performance Redis message queue for Node.js β simple to use, built for scale.
- π¬ Reliable delivery with retry mechanisms
- π Multiple queue strategies: FIFO, LIFO, and Priority Queues
- π Exchange patterns: Direct, Topic, and Fanout routing
- π¦ Rate limiting for controlled message consumption
- π°οΈ Built-in scheduler for delayed and repeating messages
- π High-throughput processing
- π§΅ Worker threads for sandboxing and performance
- β±οΈ Message expiration and consumption timeouts
- π Multi-queue producers and consumers
- π REST API with OpenAPI v3 and Swagger UI
- π Web UI for real-time monitoring
- π¦ ESM & CJS module support
- Background jobs: emails, reports, data processing
- Task scheduling with automatic retries
- Microservices communication
- Real-time event processing for gaming, IoT, analytics
- Node.js 20+
- Redis 4+
- Choose one Redis client:
ioredisor@redis/client
# Core packages
npm install redis-smq@next redis-smq-common@next --save
# Pick a Redis client
npm install ioredis --save
# OR
npm install @redis/client --save
β οΈ v9 Breaking Changes: If upgrading, read the v9.0.0 Release Notes.
import { RedisSMQ } from 'redis-smq';
import { ERedisConfigClient } from 'redis-smq-common';
// Simple initialization
RedisSMQ.initialize(
{
client: ERedisConfigClient.IOREDIS,
options: { host: '127.0.0.1', port: 6379 }
},
(err) => {
if (err) console.error('RedisSMQ init failed:', err);
}
);import { RedisSMQ, EQueueType, EQueueDeliveryModel } from 'redis-smq';
const queueManager = RedisSMQ.createQueueManager();
queueManager.save(
'my_queue',
EQueueType.LIFO_QUEUE,
EQueueDeliveryModel.POINT_TO_POINT,
(err) => {
if (err) console.error('Queue creation failed:', err);
else console.log('β
Queue created');
}
);import { RedisSMQ, ProducibleMessage } from 'redis-smq';
const producer = RedisSMQ.createProducer();
producer.run((err) => {
if (err) return console.error('Producer failed:', err);
const msg = new ProducibleMessage()
.setQueue('my_queue')
.setBody('Hello World!');
producer.produce(msg, (err, ids) => {
if (err) console.error('Send failed:', err);
else console.log(`π¨ Sent message: ${ids.join(', ')}`);
});
});import { RedisSMQ } from 'redis-smq';
const consumer = RedisSMQ.createConsumer();
consumer.run((err) => {
if (err) return console.error('Consumer failed:', err);
const handler = (message, done) => {
console.log('π₯ Received:', message.body);
done(); // Acknowledge
};
consumer.consume('my_queue', handler, (err) => {
if (err) console.error('Consume failed:', err);
else console.log('π Listening on my_queue...');
});
});| Package | Description |
|---|---|
| redis-smq | Core message queue library |
| redis-smq-common | Shared utilities |
| redis-smq-rest-api | REST API with Swagger UI |
| redis-smq-web-ui | Web dashboard |
| redis-smq-web-server | Web server for UI & API |
| redis-smq-benchmarks | Performance testing |
π Version Compatibility: Always use matching versions. See version compatibility guide.
- Full Documentation - Complete API reference and guides
- REST API - API endpoints and usage
- Web UI - Dashboard setup and features
We welcome contributions! Please read CONTRIBUTING.md for guidelines.
RedisSMQ is released under the MIT License.