Registry / database / rethinkdb-job-queue

rethinkdb-job-queue

JSON →
library3.1.7jsnpmunverified

rethinkdb-job-queue is a persistent job/task queue backed by RethinkDB, designed for distributed worker nodes with pub/sub, concurrency, priority, retries, delayed jobs, timeouts, repeatable jobs, and job reanimation. The current stable version is 3.1.7. Release cadence is irregular; the project is maintained. Key differentiators from other job queues (e.g., Bull, Kue) include reliance on RethinkDB as the backing store (offering real-time changefeeds for pub/sub), built-in job history logs, and TypeScript definitions. It supports multiple queues per RethinkDB instance and global queue events.

npm install rethinkdb-job-queue
INSTALL
IMPORT
SIG · RETHINKDB-JOB-QUEU
R
rethinkdb-job-queue
databasejavascriptv3.1.7
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
import Queue from 'rethinkdb-job-queue'
const Queue = require('rethinkdb-job-queue').Queue
Default export is the Queue class. CommonJS users must use `require('rethinkdb-job-queue').default` (if using esModuleInterop) or `const Queue = require('rethinkdb-job-queue').default`.
Job
import { Job } from 'rethinkdb-job-queue'
const Job = require('rethinkdb-job-queue').Job
Job is a named export. In older versions (<3.0) it was exported differently.
QueueEvent
import { QueueEvent } from 'rethinkdb-job-queue'
import { QueueEvent } from 'rethinkdb-job-queue' (correct, no common mistake)
QueueEvent is a TypeScript enum exported for use with event listeners.

Shows creating a queue with options, adding a job, processing jobs, and subscribing to error events.

import Queue from 'rethinkdb-job-queue'; const options = { name: 'myQueue', dbConfig: { host: 'localhost', port: 28015, db: 'jobQueue' }, concurrency: 3, retryMax: 2, retryDelay: 1000 }; const queue = new Queue(options); // Add a job queue.addJob({ name: 'test-job', data: { foo: 'bar' }, priority: 1 }) .then(job => console.log('Job added:', job.id)); // Process jobs queue.process((job, done) => { console.log('Processing job:', job.id); done(null, { result: 'success' }); }); queue.on('queue:error', (err) => console.error('Queue error:', err));
Debug
Known issues
breakingIn v3.0.0, the constructor signature changed from `new Queue(connection, queueName)` to `new Queue(options)`. Options object replaces separated connection and name arguments.
fix
Update constructor call to pass a single options object with `name` and `dbConfig` properties.
affects: >=3.0.0
breakingThe `addJob` method no longer returns a promise that resolves when the job is completed; it returns immediately after inserting the job. Job completion events are now handled via the `process` callback.
fix
Use queue.process() to handle job completion and queue events for job lifecycle monitoring.
affects: >=3.0.0
deprecatedThe `start` event has been deprecated in favor of `'queue:processing'`.
fix
Use `queue.on('queue:processing', callback)` instead of `queue.on('start', callback)`.
affects: >=2.0.0 <3.0.0
gotchaIf RethinkDB is not running when the queue is instantiated, the constructor will not throw an error until the first query is attempted. Connection errors may appear as timeouts.
fix
Ensure RethinkDB is started before creating the queue, or listen for 'queue:error' to catch connection issues.
affects: >=1.0.0
gotchaThe `retryDelay` option is in milliseconds, not seconds. A common mistake is passing seconds (e.g., 10 for 10 seconds) leading to a 10ms delay.
fix
Set `retryDelay` to the desired delay in milliseconds. For 10 seconds, use 10000.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'rethinkdb-job-queue'
Package not installed correctly or peer dependency (rethinkdbdash) missing.
fix
Run `npm install rethinkdb-job-queue rethinkdbdash --save`.
TypeError: Queue is not a constructor
Default import used incorrectly in CJS environment without esModuleInterop.
fix
Use `const Queue = require('rethinkdb-job-queue').default;`
Error: connect ECONNREFUSED localhost:28015
RethinkDB server is not running or host/port wrong.
fix
Start RethinkDB: `rethinkdb` or check dbConfig host/port.
Error: Job processing failed with error: [object Object]
Error object passed to `done(err)` is not serialized properly.
fix
Pass an Error object: `done(new Error('message'))` instead of `done({...})`.
Upgrade
Version history
3.1.7latest on npm
Audit
Dependencies
rethinkdbdashrequiredDeclared as a peer dependency; this library uses rethinkdbdash, not the official rethinkdb driver.
rethinkdboptionalRuntime dependency; RethinkDB must be installed and running.
Agent activity
12 hits · last 30 days
node
10
Meta
1
Resources
rethinkdb-job-queue — npm install rethinkdb-job-queue · libregistry