Registry / messaging / cf-queue

cf-queue

JSON →
library0.0.21jsnpmunverified

cf-queue is a lightweight queue wrapper for NATS.io, facilitating a request-response pattern between clients and workers. The latest version is 0.0.21 (as of early 2023). Released via npm, the package is actively maintained by Codefresh. It simplifies building distributed job queues with progress reporting, using NATS as the message broker. Key differentiators include a simple API for creating queues, built-in progress support, and integration with Docker for easy deployment. However, it has low adoption and minimal documentation beyond the README.

npm install cf-queue
INSTALL
IMPORT
SIG · CF-QUEUE
C
cf-queue
messagingjavascriptv0.0.21
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.

Queue
✓ const Queue = require('cf-queue');
✗ import Queue from 'cf-queue'; // ESM not supported; package is CommonJS only
cf-queue is CommonJS-only. There is no ES module equivalent.
Queue
✓ const Queue = require('cf-queue');
Default export, no named exports.

Initializes a queue, pushes a request as a client, and processes jobs as a worker.

const Queue = require('cf-queue'); const options = { servers: ['nats://localhost:4222'] }; const queue = new Queue('my-queue', options); // Client side: send a request const request = { id: 1, message: 'hello' }; queue.request(request) .then(response => console.log(response)) .catch(err => console.error(err)); // Worker side: process jobs queue.process((job, callback) => { const request = job.request; const response = { id: request.id, message: request.message + ' world!!!' }; callback(null, response); });
Debug
Known issues
gotchaThe package is not compatible with ES modules (import syntax). Use require() only.
fix
Use CommonJS require() instead of ESM import.
affects: >=0.0.0
gotchaProgress support may not be fully documented or stable; relies on undocumented NATS features.
fix
Test progress behavior thoroughly before using in production.
affects: >=0.0.0
gotchaThe package has low maintenance; issues or PRs may not be addressed promptly.
fix
Monitor the repository or consider alternatives like Bull or Bee-Queue.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'nats'
Missing peer dependency nats.
fix
npm install nats
TypeError: queue.request(...).progress is not a function
Progress method not available if NATS version mismatches or queue not properly configured.
fix
Ensure your NATS server and client versions are compatible, and that progress is enabled on the queue.
Upgrade
Version history
0.0.21latest on npm
Audit
Dependencies
natsrequiredCore dependency: cf-queue wraps nats.io functionality.
Agent activity
27 hits · last 30 days
node
26
OpenAI (training)
1
Resources
cf-queue — npm install cf-queue · libregistry