Skip to content

Queue.addJob

Grant Carthew edited this page Jul 28, 2016 · 11 revisions

Method Signature

Queue.addJob(Job)

Parameter: Job - One or more Job objects from Queue.createJob.

Returns: Promise => Array - An array of one or more Job objects.

Example:

q.addJob(jobs).then((savedJobs) => {
  // savedJobs is an array of one or more Jobs
}).catch((err) => {
  console.error(err)
})

Description

To use rethinkdb-job-queue you need to add Job objects to the Queue. Job objects can be created by using the Queue.createJob method.

After calling Queue.createJob you will have a valid Job object which is only stored in local memory. This Job object can now be populated with any data you will need to process the job.

At this point in time, the Job is not in the Queue and will not be processed. Calling Queue.addJob(job) will save the job into the backing database table and expose the job to any node available to process it.

Queue.addJob(job) returns a bluebird Promise. If you are using a different Promise library or a different version of bluebird, ensure you encapsulate the returned Promise in your own promises.

Main

How It Works

Contributing

API

Queue Methods

Queue Properties

Queue Events

Job Methods

Job Properties

Documentation

Clone this wiki locally