Registry / messaging / kue
library0.11.6jsnpmunverified

Kue is a priority job queue backed by Redis for Node.js, featuring delayed jobs, parallel workload distribution, job event and progress pubsub, job TTL, optional retries with backoff, graceful shutdown, full-text search, RESTful JSON API, and a rich integrated UI. Current stable version is 0.11.6, released irregularly with maintenance updates. Key differentiators include a built-in UI for monitoring, priority system with named levels, and support for job progress tracking and logging. Compared to Bull or Bee-Queue, Kue offers more out-of-the-box UI features but is less actively maintained.

npm install kue
INSTALL
IMPORT
SIG · KUE
K
kue
messagingjavascriptv0.11.6
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.

kue
import kue from 'kue'
const kue = require('kue')
ESM default import is preferred; require() works in CommonJS.
createQueue
const queue = kue.createQueue();
const queue = new kue.Queue();
Kue uses a factory function, not a constructor.
Job
import { Job } from 'kue';
const Job = kue.Job;
Named import available in ESM; CommonJS uses require('kue').Job.

Shows how to create a queue, enqueue a high-priority email job, process it, and gracefully shutdown on SIGTERM.

import kue from 'kue'; const queue = kue.createQueue(); // Create a job const job = queue.create('email', { title: 'welcome email for tj', to: 'tj@learnboost.com', template: 'welcome-email' }).priority('high').save(err => { if (err) console.error('Save error:', err); else console.log('Job created:', job.id); }); // Process jobs queue.process('email', (job, done) => { console.log('Processing job', job.id, 'for', job.data.to); done(); }); process.on('SIGTERM', () => { queue.shutdown(5000, err => { console.log('Shutdown complete', err || ''); process.exit(0); }); });
Debug
Known issues
breakingIn Kue 0.10.x, the Redis connection settings changed: redis.createClient() options are passed differently.
fix
Use queue.createQueue({redis: {host: 'localhost', port: 6379}}) instead of passing to kue.createQueue({redis: ...}).
affects: >=0.10
deprecatedJob.events() is deprecated since 0.9.x; use queue-level events instead.
fix
Use queue.on('job complete', ...) or job.on('complete', ...) but prefer queue-level.
affects: >=0.9
breakingqueue.shutdown() signature changed from (timeout, fn) to (timeout, type, fn) in 0.10.x.
fix
Use queue.shutdown(5000, 'work', callback) where type can be 'work' or 'jobs'.
affects: >=0.10
gotchaKue requires Redis to be running; it does not start Redis automatically. Missing Redis results in cryptic errors.
fix
Ensure Redis server is running and accessible before creating a queue.
affects: >=0.8
gotchaJob data size is limited by Redis; large payloads may cause errors.
fix
Keep job data small; store large data externally (e.g., file or database) and reference by ID.
affects: >=0.8
deprecatedqueue.process() without concurrency limit uses unlimited concurrency, which can overwhelm resources.
fix
Always specify concurrency: queue.process('email', 5, handler).
affects: >=0.8
Errors
Common errors & fixes
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
Redis server is not running or not accessible at the default host/port.
fix
Start Redis: redis-server, or configure custom Redis connection: kue.createQueue({redis: {host: 'myhost', port: 6380}}).
TypeError: job.save is not a function
Calling save() on a Job object that is not properly created via queue.create().
fix
Ensure you use queue.create(type, data) which returns a Job instance: const job = queue.create('email', {}); job.save(cb);
Error: job.priority is not a function
Calling priority() on a Job object before calling save() is fine, but misordering methods may cause issues.
fix
Chain priority before save: queue.create('email', {}).priority('high').save(cb);
Error: Redis connection to 127.0.0.1:6379 failed - connect EHOSTUNREACH
Network issue: Redis host is unreachable (e.g., wrong hostname or network down).
fix
Check Redis host configuration: kue.createQueue({redis: {host: 'correct-host'}}); ensure network connectivity.
Error: Job type "email" already defined
Calling queue.process() multiple times for the same job type.
fix
Define processing for each job type only once; remove duplicate queue.process('email', ...) calls.
Upgrade
Version history
0.11.6latest on npm
Audit
Dependencies
redisrequiredKue uses Redis as its backend for job storage and queue management.
Agent activity
20 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
packagekue
kue — npm install kue · libregistry