1.0.6 • Published 5 years ago
fast-job-queue v1.0.6
fast-job-queue
Fast and simple create and manage your jobs/task in queue for NodeJs with redis.
Adding and initializing fast-job-queue
Download with npm
npm install fast-job-queue
then, initialize it..
const fastQueue = require('fast-job-queue'); const job = new fastQueue({retry: 3});
Adding new Job or Task to queue
- then, create job
job.createJob({title: "my Job", value: 1});
Receiving Job to process
then,
job.on("process", (jobdata, done, failed) => { // do your task here // once job is completed call done method on job if(success){ done(); } else{ // failed job will got to queue again for retry // if retry limit is set in settings. failed(); } })
On Job complete
- you can catch completed job here
job.on("complete", (data) => { console.log("Job completed!", data); })