Registry / devops / node-simple-queue

node-simple-queue

JSON →
library1.0.4jsnpmunverified

A MongoDB-backed job queue for Node.js with a Resque-like API. Version 1.0.4 (latest) provides basic enqueue/dequeue operations, job classes with a perform method, and a CLI worker. Requires MongoDB for storage and is intended for simple background job processing in Node.js. Release cadence is sparse; the package has not been updated recently. Its key differentiator is simplicity, but it lacks advanced features like retries, scheduling, or priority queues.

npm install node-simple-queue
INSTALL
IMPORT
SIG · NODE-SIMPLE-QUEUE
N
node-simple-queue
devopsjavascriptv1.0.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.

NodeQueue
import { NodeQueue } from 'node-simple-queue'
const NodeQueue = require('node-simple-queue')
Named export, not default. CommonJS require works but ESM import is correct.
NodeQueue (CommonJS)
const { NodeQueue } = require('node-simple-queue')
const NodeQueue = require('node-simple-queue').NodeQueue
Both patterns work, but destructuring is cleaner.
Job class
class MyJob { static perform(data, done) { ... } }
MyJob.perform = function(data, done) { ... }
Job classes require a static perform method. Can be defined as a class or constructor function.

Demonstrates importing NodeQueue, defining a global job class, enqueueing a job, and starting a worker from CLI.

const { NodeQueue } = require('node-simple-queue'); const queue = new NodeQueue(); // Define a job class (must be global for worker to find) class MyJob { static perform(data, done) { console.log('Processing:', data); done(null, true); } } global.MyJob = MyJob; // Enqueue a job queue.enqueueJob('myqueue', 'MyJob', { message: 'Hello' }); // Start worker via CLI: // node node_modules/node-simple-queue/bin/node-worker start QUEUE=myqueue WORKERS=2 console.log('Job enqueued!');
Debug
Known issues
gotchaJob class must be defined globally (as a property of global object) for the worker to find it.
fix
Assign your job class to global scope: global.MyJob = MyJob;
affects: *
deprecatedPackage uses MongoDB directly but does not list it as a dependency; you must install mongodb separately.
fix
Run: npm install mongodb
affects: *
breakingWorker CLI expects the binary at node_modules/node-simple-queue/bin/node-worker; global install may break path.
fix
Use npx or full path: node ./node_modules/node-simple-queue/bin/node-worker start ...
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'mongodb'
Missing mongodb dependency; not declared in package.json.
fix
Run: npm install mongodb
TypeError: job_class.perform is not a function
Job class is not defined globally or missing static perform method.
fix
Ensure class is assigned to global (global.MyJob = MyJob) and has a static perform(data, done) method.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
mongodbrequiredUses MongoDB for queue storage (implied by setup, not declared as peer dependency)
Agent activity
2 hits · last 30 days
node
2
Resources
node-simple-queue — npm install node-simple-queue · libregistry