Registry / messaging / rsmq
library0.12.4jsnpmunverified

RSMQ is a lightweight FIFO message queue for Node.js that requires only a Redis server (no dedicated queue server). Version 0.12.4 (stable) runs on Node >=6 and Redis >=2.6 (due to Lua scripts). It guarantees message delivery to exactly one consumer within a configurable visibility timeout. The core library is ~500 lines of JavaScript and ships TypeScript type definitions. Optional promise-based API via *Async method suffixes. Key differentiator vs Bull or Kue: no dependencies beyond Redis, minimal API surface, and very high throughput (10k+ messages/sec). Releases are infrequent; maintained by smrchy.

npm install rsmq
INSTALL
IMPORT
SIG · RSMQ
R
rsmq
messagingjavascriptv0.12.4
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.

RedisSMQ
✓ import RedisSMQ from 'rsmq'
✗ const RedisSMQ = require('rsmq')
ESM default import (CJS works but is not recommended). The library ships TypeScript types.
RedisSMQ
✓ const RedisSMQ = require('rsmq')
✗ import { RedisSMQ } from 'rsmq'
CommonJS require for older Node versions; named import is incorrect.
QueueInstance
✓ const queue = new RedisSMQ({ host: '127.0.0.1', port: 6379, ns: 'rsmq' })
✗ const queue = new RedisSMQ({ namespace: 'rsmq' })
Constructor option is `ns`, not `namespace`. See docs.

This shows how to instantiate RSMQ, create a queue, send a message, receive it, and delete it using callback-based API.

import RedisSMQ from 'rsmq'; import redis from 'redis'; const client = redis.createClient(); const queue = new RedisSMQ({ client, ns: 'test' }); // Create queue queue.createQueue({ qname: 'myqueue' }, (err, resp) => { if (err) throw err; console.log('Queue created:', resp); }); // Send a message queue.sendMessage({ qname: 'myqueue', message: 'Hello RSMQ!' }, (err, msgId) => { if (err) throw err; console.log('Message sent, id:', msgId); }); // Receive a message queue.receiveMessage({ qname: 'myqueue' }, (err, msg) => { if (err) throw err; if (msg) { console.log('Received:', msg.message); // Delete after processing queue.deleteMessage({ qname: 'myqueue', id: msg.id }, (err) => { if (err) throw err; console.log('Deleted'); }); } }); queue.quit(); client.quit();
Debug
Known issues
breakingConstructor options changed between 0.11.x and 0.12.x: `redisClient` renamed to `client`.
fix
Replace `redisClient` with `client` in constructor options.
affects: >=0.12.0
deprecatedThe callback pattern is deprecated in favor of async methods suffix (e.g., `receiveMessage` vs `receiveMessageAsync`).
fix
Use `Async`-suffixed methods and `await` with try/catch instead of callbacks.
affects: >=0.9.0
gotchaQueue creation with `createQueue` is synchronous and will overwrite existing queue parameters if not careful.
fix
Check queue existence first with `getQueueAttributes` if you don't want to overwrite parameters.
affects: *
gotchaRedis 2.6+ is required; using older Redis will cause cryptic Lua script errors (e.g., 'ERR Error running script...').
fix
Upgrade Redis to at least 2.6, preferably 3.x or later.
affects: *
deprecatedThe `host` + `port` constructor parameters are deprecated in favor of passing a `client` instance.
fix
Create your own Redis client and pass it via `client` option.
affects: >=0.11.0
Errors
Common errors & fixes
TypeError: RedisSMQ is not a constructor
Using named import `import { RedisSMQ } from 'rsmq'` instead of default import.
fix
Use `import RedisSMQ from 'rsmq'` (default import).
Error: Redis connection refused
No Redis server running at the configured host/port.
fix
Start Redis server or check `host`/`port` configuration.
Error: ERR Error running script (call to f_...): @user_script:1: Lua redis lib command args must be strings or integers
Passing non-string/non-integer values to RSMQ methods (e.g., number message).
fix
Ensure all method parameters are strings or numbers; convert objects with JSON.stringify.
Error: Queue <name> not found
Trying to send/receive from a queue that doesn't exist.
fix
Create queue first with `createQueue` or use `listQueues` to check available queues.
Upgrade
Version history
0.12.4latest on npm
Audit
Dependencies
redisrequiredRSMQ wraps the node_redis client for all Redis operations
Agent activity
19 hits · last 30 days
node
18
OpenAI (training)
1
Resources
packagersmq ↗
rsmq — npm install rsmq · libregistry