-
Notifications
You must be signed in to change notification settings - Fork 16
Queue Events
The rethinkdb-job-queue
Queue object supports raising Node.js Events. For a full list of supported events use the menu on the right or see the Queue API document.
Depending on the changeFeed Queue option, the events will either be local to the Queue object, or global for the whole queue.
With this in mind, if you are not interested in events from other worker Queue objects, when you create your local Queue object make sure you set the changeFeed option to false.
All of the following examples use only the completed event. Again, for a full list of supported events use the menu on the right or see the Queue API document.
Note: These examples are not full examples because they do not include the code to create a job and add it to the queue.
This example will raise the completed event when a job is completed for the local Queue object only.
const Queue = require('rethinkdb-job-queue')
const qOptions = {
changeFeed: false
}
const q = new Queue(null, qOptions)
q.on('completed', (queueId, jobId, isRepeating) => {
console.log('Job completed: ' + jobId)
})
This example will raise the completed event when any job in the queue is completed. This includes jobs processed by the local Queue object or any other Queue object on the same machine or distributed across multiple machines.
const Queue = require('rethinkdb-job-queue')
const qOptions = {
changeFeed: true // This is the default and is not required
}
const q = new Queue(null, qOptions)
q.on('completed', (queueId, jobId, isRepeating) => {
console.log('Job completed: ' + jobId)
})
- 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