Skip to content

Queue Connection

Grant Carthew edited this page Sep 20, 2016 · 1 revision

Description

When creating the Queue object you can supply options to define the location of the RethinkDB database. If you would prefer to supply a rethinkdbdash object you can replace the options with the driver object. See the Queue Constructor document for more detail.

Option Type Default
host String localhost
port Integer 28015
db String rjqJobQueue

Options Example

This example is to show all the options being customized:

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

const cxnOptions = {
  host: 'proddb.domain.com',
  port: 10000,
  db: 'JobQueue'
}

const qOptions = {
  name: 'VideoProcess',
  masterInterval: 1000,
  changeFeed: true,
  concurrency: 50,
  removeFinishedJobs: false
}

const q = new Queue(cxnOptions, qOptions)

Queue host Option

Default: localhost

Valid: IP Address or DNS name of the RethinkDB server.

The host option can be ignored if you are running RethinkDB on the same machine as the nodejs service. If not, point the queue to the server you have RethinkDB running on.

host Example

This example points the Queue object at an IP address:

const Queue = require('rethinkdb-job-queue')
const q = new Queue({ host: '192.168.1.10' })

This example points the Queue object at a DNS name:

const Queue = require('rethinkdb-job-queue')
const q = new Queue({ host: 'proddb.domain.com' })

Queue port Option

Default: 28015

Valid: Integer up to 65535.

The port option allows you to specify the TCP port used by the RethinkDB database.

port Example

const Queue = require('rethinkdb-job-queue')
const q = new Queue({ port: 8000 })

Queue db Option

Default: rjqJobQueue

Valid: Any string value. Don't use spaces.

Set the db option to be the name of your job database in RethinkDB. The db option will either create a new database if it does not exist, or use an existing database. If you would like your existing database to hold your job Tables, simply set the db option to the existing name you are using in RethinkDB.

Important: There is no API call in rethinkdb-job-queue that can drop the database. The Queue.drop method only drops the queue Table in the database, not the database itself.

db Example

const Queue = require('rethinkdb-job-queue')
const q = new Queue({ db: 'JobQueue' })

Main

How It Works

Contributing

API

Queue Methods

Queue Properties

Queue Events

Job Methods

Job Properties

Documentation

Clone this wiki locally