Skip to content

State Document

Grant Carthew edited this page Feb 10, 2017 · 4 revisions

Description

To enable the passing of messages to Queue objects in a distributed processing environment, rethinkdb-job-queue uses a document in the queue table called the State Document.

Here is an example of the State Document:

{
  dateChange: Thu Oct 06 2016 04:18:58 GMT+00:00,
  id: '86f6ff5b-0c4e-46ad-9a5f-e90eb19c9b00',
  queueId: 'WebDev::rjqJobQueueTestJobs:9302:3684e084-71a8-4ebc-8954-fb42a5e73ee9',
  state: 'reviewed'
}

To make it easy to use the State Document the id value is fixed and will never change. The State Document will always have an id of 86f6ff5b-0c4e-46ad-9a5f-e90eb19c9b00.

The Queue objects never read this document. It's purpose is to cause change feeds to be updated which in turn are converted to global state changes by each Queue object.

There are three state changes that occur within the queue:

  • paused
  • active
  • reviewed

If a Queue object receives a paused global state update, it will change its own status to paused. This enables any Queue object to globally pause the queue. See Queue.pause for more detail.

If a Queue object receives an active global state update, it will resume processing if paused. This enables any Queue object to globally resume the queue processing. See Queue.resume for more detail.

When a Queue Master completes the queue review process it updates the State Document to a state of reviewed. All Queue objects connected to the queue will restart processing if their running job count is less than their concurrency value. See the Queue Master document for more detail.

Main

How It Works

Contributing

API

Queue Methods

Queue Properties

Queue Events

Job Methods

Job Properties

Documentation

Clone this wiki locally