Registry / messaging / redis-ccp-queue

redis-ccp-queue

JSON →
library1.1.1jsnpmunverified

A minimal competing-consumers pattern queue built on Redis (about 100 lines of code). Version 1.1.1 runs on Node >=4.0. Uses BRPOP for reliable message delivery and supports multiple producers and consumers with at-least-once delivery guarantee. Lightweight alternative to Kue/Bull, but lacks persistence, retries, and scheduling.

npm install redis-ccp-queue
INSTALL
IMPORT
SIG · REDIS-CCP-QUEUE
R
redis-ccp-queue
messagingjavascriptv1.1.1
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-ccp-queue'
const Producer = require('redis-ccp-queue').Producer
ESM import available since v1.1.0. CommonJS require works with destructuring.
Consumer
import { Consumer } from 'redis-ccp-queue'
const Consumer = require('redis-ccp-queue')
Use named import. Default export is an object with Producer and Consumer.
default
import ccpq from 'redis-ccp-queue'
const ccpq = require('redis-ccp-queue')
Default import returns module object. CommonJS require also returns the module object.

Creates a producer that pushes messages to a Redis queue and a consumer that processes them. The consumer callback must call done() to acknowledge message handling.

import { Producer, Consumer } from 'redis-ccp-queue'; const producer = new Producer('myQueue'); producer.push('message'); producer.push({ hello: 'world' }); const consumer = new Consumer('myQueue', (data, done) => { console.log('Received:', data); done(); }); setTimeout(() => { consumer.stop(); process.exit(0); }, 10000);
Debug
Known issues
gotchaConsumer callback must call done() to avoid memory leak and queue blocking.
fix
Always invoke the callback's second argument (usually named done) after processing.
affects: >=1.0.0
deprecatedCalling stop() on consumer does not wait for ongoing processing to finish.
fix
Wait for active callbacks to complete before calling stop().
affects: >=1.0.0 <2.0.0
gotchaProducer.push() with object uses JSON.stringify; consumer receives string.
fix
Parse JSON string in consumer if objects were pushed.
affects: >=1.0.0
gotchaQueue key must not contain spaces or special Redis characters.
fix
Use only alphanumeric characters and underscores for queue keys.
affects: >=1.0.0
breakingRenamed from 'redis-ccp-queue' to 'redis-ccp-queue' (no change).
fix
N/A
affects: <1.0.0
Errors
Common errors & fixes
TypeError: (intermediate value).Producer is not a constructor
CommonJS require returns an object with Producer property, not class directly.
fix
Use destructuring: const { Producer } = require('redis-ccp-queue');
Error: Consumer callback must be a function
Second argument to Consumer constructor is undefined or not a function.
fix
Pass a function as second parameter, e.g., new Consumer('key', (data, done) => { ... })
Error: Producer.push() requires a message
Called push() with no argument or undefined.
fix
Always provide a string or object to push().
Error: Redis connection refused
Redis server is not running or host/port mismatch.
fix
Start Redis or configure environment variables REDIS_HOST, REDIS_PORT.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
redisrequiredrequired for queue operations
Agent activity
23 hits · last 30 days
node
22
OpenAI (training)
1
Resources
redis-ccp-queue — npm install redis-ccp-queue · libregistry