-
Notifications
You must be signed in to change notification settings - Fork 16
Job API
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.
Type: object 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.cleanCopyType: Method
Returns: Object
Parameters: string message.
Use createLog to get a basic schema populated with the jobs main properties. The returned log object will not be saved into the database until job.addLog() is called passing in the log object.
Once you have the log object, populate it with any values you would like to record for future reference prior to calling job.addLog().
Type: Method
Returns: Promise
Parameters: Object
After calling job.createLog() and getting a log object, save it against the job in the database using job.addLog(log).
- Introduction
- Tutorial
- Queue Constructor
- Queue Connection
- Queue Options
- Queue PubSub
- Queue Master
- Queue Events
- State Document
- Job Processing
- Job Options
- Job Status
- Job Retry
- Job Repeat
- Job Logging
- Job Editing
- Job Schema
- Job Name
- Complex Job
- Delayed Job
- Cancel Job
- Error Handling
- Queue.createJob
- Queue.addJob
- Queue.getJob
- Queue.findJob
- Queue.findJobByName
- Queue.containsJobByName
- Queue.cancelJob
- Queue.reanimateJob
- Queue.removeJob
- Queue.process
- Queue.review
- Queue.summary
- Queue.ready
- Queue.pause
- Queue.resume
- Queue.reset
- Queue.stop
- Queue.drop
- Queue.Job
- Queue.host
- Queue.port
- Queue.db
- Queue.name
- Queue.r
- Queue.id
- Queue.jobOptions [R/W]
- Queue.changeFeed
- Queue.master
- Queue.masterInterval
- Queue.removeFinishedJobs
- Queue.running
- Queue.concurrency [R/W]
- Queue.paused
- Queue.idle
- Event.ready
- Event.added
- Event.updated
- Event.active
- Event.processing
- Event.progress
- Event.log
- Event.pausing
- Event.paused
- Event.resumed
- Event.completed
- Event.cancelled
- Event.failed
- Event.terminated
- Event.reanimated
- Event.removed
- Event.idle
- Event.reset
- Event.error
- Event.reviewed
- Event.detached
- Event.stopping
- Event.stopped
- Event.dropped
- Job.setName
- Job.setPriority
- Job.setTimeout
- Job.setDateEnable
- Job.setRetryMax
- Job.setRetryDelay
- Job.setRepeat
- Job.setRepeatDelay
- Job.updateProgress
- Job.update
- Job.getCleanCopy
- Job.addLog
- Job.getLastLog