<commit_before># Introduction

`rethinkdb-job-queue` is a persistent job or task queue backed by [RethinkDB][rethinkdb-url].
It has been built as an alternative to using a [Redis][redis-url] backed job queue such as [Kue][kue-url], [Bull][bull-url], or [Bee-Queue][bee-queue-url].

[![bitHound Overall Score][bithound-overall-image]][bithound-overall-url]
[![bitHound Dependencies][bithound-dep-image]][bithound-dep-url]
[![bitHound Dependencies][bithound-code-image]][bithound-code-url]
[![js-standard-style][js-standard-image]][js-standard-url]
[![NSP Status][nsp-image]][nsp-url]

[![Thinker][thinker-image]][rjq-github-url]

[![NPM][nodei-npm-image]][nodei-npm-url]

Please __Star__ on GitHub / NPM and __Watch__ for updates.

## Warning: API change from v0.3.0 to v0.4.0

The `Queue.createJob()` method no longer takes an option object.

Please read the [createJob](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue.createJob) document for more detail.

To enable setting custom job options there is now a fluent API containing the following.

*   [Job.setPriority](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setPriority)
*   [Job.setTimeout](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setTimeout)
*   [Job.setRetryMax](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setRetryMax)
*   [Job.setRetryDelay](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setRetryDelay)
*   [Job.setDateEnable](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setDateEnable)

I am hoping this will be the last major API change before the v1.0.0 bump.

## Features

*   Powered by [RethinkDB][rethinkdb-url]
*   Connect to [multiple databases][queue-connection-url]
*   Create [multiple queues][queue-connection-url]
*   [Distributed worker nodes (PubSub)][queue-pubsub-url]
*   Global [queue events][queue-events-url]
*   Global [job cancellation][job-cancel-url]
*   Global [pause queue][queue-pause-url]
*   Run [concurrent jobs][queue-concurrency-url]
*   Promise based with minimal callbacks
*   [Priority processing of jobs][job-priority-url]
*   [Job progress updates][job-progress-url]
*   [Delayed job start][job-delayed-url]
*   [Find jobs in the queue][find-job-url]
*   [Determine job uniqueness][find-job-url]
*   [Job timeout][job-timeout-url]
*   [Retrying failed jobs][job-retry-url]
*   [Job reanimation][job-reanimation-url]
*   [Job Editing][job-editing-url]
*   Rich job [history log][job-log-url]
*   Over 1300 [integration tests][testing-url]



[queue-connection-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue-Connection
[queue-events-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue-Events
[queue-concurrency-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue-Options#queue-concurrency-option
[queue-pubsub-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue-PubSub
[job-priority-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job-Options#job-priority-option
[job-progress-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setProgress
[job-delayed-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Delayed-Job
[find-job-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue.findJob
[job-cancel-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue.process#failed-job-with-cancel
[queue-pause-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue.pause
[job-timeout-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job-Options#job-timeout-option
[job-retry-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job-Retry
[job-reanimation-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job-Editing#job-reanimation
[job-editing-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job-Editing
[job-log-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.log
[testing-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Testing

## Documentation

For full documentation [please see the wiki][rjq-wiki-url]

## Project Status

*   This `rethinkdb-job-queue` module is fully functional.
*   There are over 1300 integration tests.
*   This project is complete and needs to be taken out for a spin.
*   In a few months I will bump the version up to 1.0.0 to support [SemVer](http://semver.org/).
*   Please provide feedback or raise issues prior to the version bump.


## Quick Start

### Installation

Note: You will need to install [RethinkDB][rethinkdb-url] before you can use `rethinkdb-job-queue`

After installing [RethinkDB][rethinkdb-url] install the job queue using the following command.

```sh
npm install rethinkdb-job-queue --save
```

### Simple Example

```js

const Queue = require('rethinkdb-job-queue')
const qOptions = {
  name: 'Mathematics' // The queue and table name
}
const cxnOptions = {
  db: 'JobQueue', // The name of the database in RethinkDB
}

const q = new Queue(cxnOptions, qOptions)

const job = q.createJob()
job.numerator = 123
job.denominator = 456

q.process((job, next) => {
    try {
      let result = job.numerator / job.denominator
      // Do something with your result
      return next(result)
    } catch (err) {<commit_msg>Changed simple example createJob call<commit_after># Introduction

`rethinkdb-job-queue` is a persistent job or task queue backed by [RethinkDB][rethinkdb-url].
It has been built as an alternative to using a [Redis][redis-url] backed job queue such as [Kue][kue-url], [Bull][bull-url], or [Bee-Queue][bee-queue-url].

[![bitHound Overall Score][bithound-overall-image]][bithound-overall-url]
[![bitHound Dependencies][bithound-dep-image]][bithound-dep-url]
[![bitHound Dependencies][bithound-code-image]][bithound-code-url]
[![js-standard-style][js-standard-image]][js-standard-url]
[![NSP Status][nsp-image]][nsp-url]

[![Thinker][thinker-image]][rjq-github-url]

[![NPM][nodei-npm-image]][nodei-npm-url]

Please __Star__ on GitHub / NPM and __Watch__ for updates.

## Warning: API change from v0.3.0 to v0.4.0

The `Queue.createJob()` method no longer takes an option object.

Please read the [createJob](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue.createJob) document for more detail.

To enable setting custom job options there is now a fluent API containing the following.

*   [Job.setPriority](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setPriority)
*   [Job.setTimeout](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setTimeout)
*   [Job.setRetryMax](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setRetryMax)
*   [Job.setRetryDelay](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setRetryDelay)
*   [Job.setDateEnable](https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setDateEnable)

I am hoping this will be the last major API change before the v1.0.0 bump.

## Features

*   Powered by [RethinkDB][rethinkdb-url]
*   Connect to [multiple databases][queue-connection-url]
*   Create [multiple queues][queue-connection-url]
*   [Distributed worker nodes (PubSub)][queue-pubsub-url]
*   Global [queue events][queue-events-url]
*   Global [job cancellation][job-cancel-url]
*   Global [pause queue][queue-pause-url]
*   Run [concurrent jobs][queue-concurrency-url]
*   Promise based with minimal callbacks
*   [Priority processing of jobs][job-priority-url]
*   [Job progress updates][job-progress-url]
*   [Delayed job start][job-delayed-url]
*   [Find jobs in the queue][find-job-url]
*   [Determine job uniqueness][find-job-url]
*   [Job timeout][job-timeout-url]
*   [Retrying failed jobs][job-retry-url]
*   [Job reanimation][job-reanimation-url]
*   [Job Editing][job-editing-url]
*   Rich job [history log][job-log-url]
*   Over 1300 [integration tests][testing-url]



[queue-connection-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue-Connection
[queue-events-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue-Events
[queue-concurrency-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue-Options#queue-concurrency-option
[queue-pubsub-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue-PubSub
[job-priority-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job-Options#job-priority-option
[job-progress-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.setProgress
[job-delayed-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Delayed-Job
[find-job-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue.findJob
[job-cancel-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue.process#failed-job-with-cancel
[queue-pause-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue.pause
[job-timeout-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job-Options#job-timeout-option
[job-retry-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job-Retry
[job-reanimation-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job-Editing#job-reanimation
[job-editing-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job-Editing
[job-log-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Job.log
[testing-url]: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Testing

## Documentation

For full documentation [please see the wiki][rjq-wiki-url]

## Project Status

*   This `rethinkdb-job-queue` module is fully functional.
*   There are over 1300 integration tests.
*   This project is complete and needs to be taken out for a spin.
*   In a few months I will bump the version up to 1.0.0 to support [SemVer](http://semver.org/).
*   Please provide feedback or raise issues prior to the version bump.


## Quick Start

### Installation

Note: You will need to install [RethinkDB][rethinkdb-url] before you can use `rethinkdb-job-queue`

After installing [RethinkDB][rethinkdb-url] install the job queue using the following command.

```sh
npm install rethinkdb-job-queue --save
```

### Simple Example

```js

const Queue = require('rethinkdb-job-queue')
const qOptions = {
  name: 'Mathematics' // The queue and table name
}
const cxnOptions = {
  db: 'JobQueue', // The name of the database in RethinkDB
}

const q = new Queue(cxnOptions, qOptions)

const job = q.createJob({
  numerator: 123,
  denominator: 456
})

q.process((job, next) => {
    try {
      let result = job.numerator / job.denominator
      // Do something with your result
      return next(result)
    } catch (err) {
{'fraction_non_alphanumeric': 0.14853402175917388, 'fraction_numerical': 0.004794394246726904, 'mean_word_length': 4.679057591623037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 44, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '274566', 'n_tokens_mistral': 3798, 'n_tokens_neox': 3690, 'n_words': 720}