![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
rethinkdb-job-queue
Advanced tools
rethinkdb-job-queue
is a persistent job or task queue backed by RethinkDB.
It has been build as an alternative to using a Redis backed job queue such as Kue, Bull, or Bee-Queue.
Please Star on GitHub / NPM and Watch for updates.
For full documentation please see the wiki
rethinkdb-job-queue
module is fully functional.Note: You will need to install RethinkDB before you can use rethinkdb-job-queue
After installing RethinkDB install the job queue using the following command.
npm install rethinkdb-job-queue --save
const Queue = require('rethinkdb-job-queue')
const qOptions = {
name: 'Mathematics' // The queue and table name
}
const cxnOptions = {
db: 'JobQueue', // The name of the database in RethinkDB
}
const q = new Queue(cxnOptions, qOptions)
const job = q.createJob()
job.numerator = 123
job.denominator = 456
q.process((job, next) => {
try {
let result = job.numerator / job.denominator
// Do something with your result
return next(result)
} catch (err) {
console.error(err)
return next(err)
}
})
return q.addJob(job).catch((err) => {
console.error(err)
})
// The following is not related to rethinkdb-job-queue.
// This is the nodemailer configuration
const nodemailer = require('nodemailer')
const transporter = nodemailer.createTransport({
service: 'Mailgun',
auth: {
user: 'postmaster@superheros.com',
pass: 'your-api-key-here'
}
})
// Setup e-mail data with unicode symbols
var mailOptions = {
from: '"Registration" <support@superheros.com>', // Sender address
subject: 'Registration', // Subject line
text: 'Click here to complete your registration', // Plaintext body
html: '<b>Click here to complete your registration</b>' // HTML body
}
// rethinkdb-job-queue configuration
const Queue = require('rethinkdb-job-queue')
// Queue options have defaults and are not required
const qOptions = {
name: 'RegistrationEmail', // The queue and table name
masterInterval: 310000, // Database review period in milliseconds
changeFeed: true, // Enables events from the database table
concurrency: 100,
removeFinishedJobs: 2592000000, // true, false, or number of milliseconds
}
// Connection options have defaults and are not required
// You can replace these options with a rethinkdbdash driver object
const cxnOptions = {
host: 'localhost',
port: 28015,
db: 'JobQueue', // The name of the database in RethinkDB
}
// This is the main queue instantiation call
const q = new Queue(cxnOptions, qOptions)
// Customizing the default job options for new jobs
q.jobOptions = {
priority: 'normal',
timeout: 300000,
retryMax: 3, // Four attempts, first then three retries
retryDelay: 600000 // Time in milliseconds to delay retries
}
const job = q.createJob()
// The createJob method will only create the job locally.
// It will need to be added to the queue.
// You can decorate the job with any data to be saved for processing
job.recipient = 'batman@batcave.com'
q.process((job, next) => {
// Send email using job.recipient as the destination address
mailOptions.to = job.recipient
return transporter.sendMail(mailOptions).then((info) => {
console.dir(info)
return next(info)
}).catch((err) => {
// This catch if for nodemailer sendMail errors.
return next(err)
})
})
return q.addJob(job).then((savedJobs) => {
// savedJobs is an array of the jobs added with updated properties
}).catch((err) => {
console.error(err)
})
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
Please see the debugging and testing documents for more detail.
Thanks to the following marvelous packages and people for their hard work:
This list could go on...
MIT
FAQs
A persistent job or task queue backed by RethinkDB.
The npm package rethinkdb-job-queue receives a total of 66 weekly downloads. As such, rethinkdb-job-queue popularity was classified as not popular.
We found that rethinkdb-job-queue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.