Skip to content

Job API

Grant Carthew edited this page Jul 1, 2016 · 22 revisions

Description

Job objects are created by calling queue.createJob() passing data and options. The jobs will not be saved into the queue database until you call queue.addJob() passing in the job object.

Job objects can also be accessed during execution of the queue.process() callback function, and by calling queue.getJob() passing the id of the job.

The methods below can be used to interact with the job objects.

cleanCopy getter

Returns:_ A JavaScript Object populated with the properties of the job.

This method is mostly used within the rethinkdb-job-queue to save the jobs to the database. You can use this method if you want a copy of the job properties.

The returned job object has all methods and the reference to the owning Queue removed leaving only the jobs properties. The job.priority value will be converted to a string rather than the integer saved in the database.

const Queue = require('rethinkdb-job-queue')
const queue = new Queue(options)

const job = queue.createJob({ job:data })
const cleanCopy = job.cleanCopy

Main

How It Works

Contributing

API

Queue Methods

Queue Properties

Queue Events

Job Methods

Job Properties

Documentation

Clone this wiki locally