Registry / messaging / redis-smq

redis-smq

JSON →
library10.1.2jsnpmunverified

RedisSMQ is a high-performance, reliable, and scalable message queue for Node.js, backed by Redis. Current stable version is 10.1.2, with regular releases. It focuses on robustness and simplicity, providing queue models, delivery models, and producer/consumer APIs. Key differentiators include production readiness, easy operation, support for both ioredis and the official @redis/client, and optional REST API and Web UI for monitoring and administration. It requires Node.js >=20 and has peer dependencies on @redis/client (^5), ioredis (^5), and redis-smq-common (^10.1.2).

npm install redis-smq
INSTALL
IMPORT
SIG · REDIS-SMQ
R
redis-smq
messagingjavascriptv10.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Producer
import { Producer } from 'redis-smq';
const { Producer } = require('redis-smq');
ESM-only since v10; CommonJS require will fail.
Consumer
import { Consumer } from 'redis-smq';
const consumer = new Consumer();
Consumer is a named export, not a default export. Also, constructor may require config.
QueueManager
import { QueueManager } from 'redis-smq';
import QueueManager from 'redis-smq';
QueueManager is a named export; default import is undefined.

Demonstrates basic usage: connecting to Redis, creating a producer to send a message, creating a consumer to process messages, and listing queues via QueueManager.

import { Producer, Consumer, QueueManager } from 'redis-smq'; import { RedisClient } from 'redis-smq-common'; async function main() { // Connect to Redis (uses ioredis by default, configure via constructor) const client = new RedisClient({ host: 'localhost', port: 6379 }); await client.connect(); // Create a producer and send a message const producer = new Producer({ client }); const msgId = await producer.send({ queue: 'my-queue', body: 'Hello World' }); console.log('Message sent:', msgId); // Create a consumer and consume messages const consumer = new Consumer({ client, consume: (msg, cb) => { console.log('Received:', msg.body); cb(); // ack the message }}); await consumer.run(); // Manage queues const manager = new QueueManager({ client }); const queues = await manager.listQueues(); console.log('Queues:', queues); await client.disconnect(); } main().catch(console.error);
Debug
Known issues
breakingESM-only since v10: 'redis-smq' no longer supports CommonJS require().
fix
Convert project to ESM (type: 'module' in package.json) and use import statements.
affects: >=10.0.0
breakingNode.js >=20 required as of v10.
fix
Upgrade Node.js to version 20 or later.
affects: >=10.0.0
breakingRemoved deprecated APIs: 'Message', 'Queue', 'Exchange' exports no longer exist.
fix
Use Producer, Consumer, QueueManager instead.
affects: >=10.0.0
deprecatedioredis support will be removed in a future major version; prefer @redis/client.
fix
Switch to @redis/client as the Redis driver.
affects: >=10.0.0
gotchaConstructor of Producer/Consumer requires a RedisClient instance; passing raw Redis connection will fail.
fix
Instantiate RedisClient from 'redis-smq-common' and pass it as 'client' option.
affects: >=10.0.0
gotchaConsumer's 'consume' callback must call cb() to acknowledge message; not calling cb() will leave message unacked.
fix
Always invoke cb() after processing, or use cb(new Error('...')) to reject.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'redis-smq'
Missing or not installed package.
fix
Run npm install redis-smq and ensure Node.js >=20.
TypeError: redis.createClient is not a function
Using @redis/client incorrectly as a constructor.
fix
Use new RedisClient() from 'redis-smq-common' instead of raw @redis/client.
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/redis-smq/index.js not supported.
Using CommonJS require() with ESM-only package.
fix
Convert to ESM or use dynamic import: import('redis-smq').
Upgrade
Version history
10.1.2latest on npm
Audit
Dependencies
@redis/clientoptionalRedis client driver (alternative to ioredis)
ioredisoptionalRedis client driver (alternative to @redis/client)
redis-smq-commonrequiredShared utilities and types for redis-smq
Agent activity
18 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
redis-smq — npm install redis-smq · libregistry