Registry / messaging / modest-queue

modest-queue

JSON →
library0.5.0jsnpmunverified

Simple FIFO Redis queue with DLQ, configurable retries, visibility timeout, delayed and priority messages. v0.5.0 (stable). Requires Redis 5+ for zpopmin. Differentiator: built-in DLQ replay, configurable retry strategies, and TypeScript types. Alternative to Bull/BullMQ with simpler API and fewer dependencies.

npm install modest-queue
INSTALL
IMPORT
SIG · MODEST-QUEUE
M
modest-queue
messagingjavascriptv0.5.0
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.

ModestQueue
import { ModestQueue } from 'modest-queue'
const ModestQueue = require('modest-queue')
ESM only; named export. TypeScript types included. You must import 'reflect-metadata' before use.
Default export
import { ModestQueue } from 'modest-queue'
import ModestQueue from 'modest-queue'
No default export; use named import.
Type imports
import { ModestQueue } from 'modest-queue'
import { ModestQueue } from 'modest-queue/dist'
Types are bundled in main entry, no need to import from dist.

Shows basic initialization, message publishing (simple & delayed with priority), polling, and success acknowledgment.

import 'reflect-metadata'; import { ModestQueue } from 'modest-queue'; async function main() { const queue = new ModestQueue({ queueName: 'tasks', connectionString: process.env.REDIS_URL ?? 'redis://localhost:6379', visibilityTimeout: 30, // seconds maxRetries: 3, }); await queue.initialize(); // Publish a simple message await queue.publish('hello world'); // Publish with delay (1 second) and priority await queue.publish('delayed message', { delay: 1000, priority: 10 }); // Poll for a message const message = await queue.pollForMessage(); if (message) { console.log('Received:', message.body); // Process and acknowledge await queue.messageSucceeded(message); } await queue.dispose(); } main().catch(console.error);
Debug
Known issues
breakingRequires ioredis v5+ as peer dependency. Earlier versions incompatible due to method changes.
fix
Update ioredis to version 5.x or later.
affects: <0.5.0
gotchaYou must import 'reflect-metadata' before using ModestQueue. Without it, class-transformer decorators fail silently.
fix
Add import 'reflect-metadata' at the very top of your entry file.
affects: >=0.0.0
deprecatedThe constructor option 'connectionString' is deprecated in favor of 'redisConnection' for passing ioredis instance directly.
fix
import Redis from 'ioredis'; new ModestQueue({ redisConnection: new Redis() })
affects: >=0.5.0
gotchaMessage body is not automatically serialized/deserialized. Complex objects must be stringified before publish and parsed after poll.
fix
await queue.publish(JSON.stringify({ key: 'value' })); // then JSON.parse(msg.body)
affects: >=0.0.0
gotchaRedis version must be 5 or higher due to use of zpopmin. Older Redis versions will throw command not found.
fix
Upgrade Redis server to version 5.0+.
affects: >=0.0.0
gotchaModestQueue does not support queue persistence across restarts in the same way as Bull. Messages are lost if Redis is flushed.
fix
Ensure Redis persistence is configured (RDB/AOF) if message durability is required.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Class constructor ModestQueue cannot be invoked without 'new'
Using CommonJS require instead of ES6 import.
fix
Use import { ModestQueue } from 'modest-queue' and ensure 'type':'module' in package.json or use .mjs extension.
Error: reflect-metadata shim is required when using class-transformer
Missing import 'reflect-metadata' at entry point.
fix
Add 'import "reflect-metadata"' at the top of your application entry file before using ModestQueue.
ERR unknown command 'ZPOPMIN'
Redis server version is below 5.0.0.
fix
Upgrade Redis to version 5.0.0 or higher.
ioredis: Unhandled error event: ReplyError: MOVED 1234
Connecting to a Redis cluster with unsupported configuration (e.g., non-clustered connection).
fix
Use a clustered ioredis instance with proper cluster options.
TypeError: Cannot read properties of undefined (reading 'options')
Missing or malformed ModestQueue constructor options.
fix
Provide a valid config object with 'queueName' and either 'connectionString' or 'redisConnection'.
Upgrade
Version history
0.5.0latest on npm
Audit
Dependencies
ioredisoptionalUnderlying Redis client for all queue operations. Required but abstracted; you can pass your own connection string or ioredis instance.
reflect-metadataoptionalRequired by class-transformer for decorator support. Must be imported at application entry point before using ModestQueue.
class-transformeroptionalUsed internally for message serialization/deserialization. Not required if you use simple strings/JSON.
Agent activity
23 hits · last 30 days
node
20
Amazon
1
OpenAI (training)
1
Resources