chore: rename module to elastiq

This commit is contained in:
2017-08-08 19:34:48 -07:00
parent 170ba3b8a0
commit 83a0352202
8 changed files with 40 additions and 40 deletions

View File

@@ -1,10 +1,12 @@
[![Build Status](https://travis-ci.org/w33ble/esqueue.svg?branch=master)](https://travis-ci.org/w33ble/esqueue)
[![Apache License](https://img.shields.io/badge/license-apache_2.0-a9215a.svg)](https://raw.githubusercontent.com/w33ble/esqueue/master/LICENSE)
[![Project Status](https://img.shields.io/badge/status-experimental-orange.svg)](https://github.com/w33ble/esqueue#project-status)
[![Build Status](https://travis-ci.org/w33ble/elastiq.svg?branch=master)](https://travis-ci.org/w33ble/elastiq)
[![Apache License](https://img.shields.io/badge/license-apache_2.0-a9215a.svg)](https://raw.githubusercontent.com/w33ble/elastiq/master/LICENSE)
[![Project Status](https://img.shields.io/badge/status-experimental-orange.svg)](https://github.com/w33ble/elastiq#project-status)
# esqueue
# elastiq
`esqueue` is an Elasticsearch-powered job queue. This is not supported by Elastic.
`elastiq` is an Elasticsearch-powered job queue.
Pronounced Elasti-queue. This is not supported by Elastic.
## Project Status
@@ -14,20 +16,17 @@ While it's believed to be pretty stable, this library isn't really being used an
Version | Elasticsearch Version
------- | ---------------------
2.x + | 5.x +
0.x-1.x | 2.x-4.x
3.x + | 5.x +
`npm install esqueue`
`npm install elastiq`
If you are working with an older version of Elasticsearch, you need it to work with an older version of esqueue. For example:
`npm install esqueue@^1.0.0`
If you are working with an older version of Elasticsearch, consider using `esqueue`.
## Usage
Simply include the module in your application.
`var Esqueue = require('esqueue');`
`var elastiq = require('elastiq');`
### Creating a queue
@@ -37,7 +36,7 @@ The first step is to create a new Queue instance. This is your point of entry, i
var index = 'my-index';
var options = {};
var queue = new Esqueue(index, options);
var queue = new Elastiq(index, options);
```
The queue instance is an event emitter, so you can listen for `error` events as you would any other event emitter.
@@ -49,7 +48,7 @@ Option | Default | Description
interval | `week` | Valid choices are `year`, `month`, `week`, `day`, `hour`, and even `minute`. | `week`
dateSeparator | `-` | Separator for the formatted date, *YYYY-MM-DD* for example, in the index pattern.
timeout | `10000` | The default job timeout, in `ms`. If workers take longer than this, the job is re-queued for another worker to complete it.
doctype | `esqueue` | The doctype to use in Elasticsearch
doctype | `elastiq` | The doctype to use in Elasticsearch
indexSettings | | Specify which `settings` to pass on index creation. See the [Elasticsearch index creation docs](https://www.elastic.co/guide/en/elasticsearch/reference/2.3/indices-create-index.html) for more info.
client | | Options to use when creating a new client instance - see [the elasticsearch-js docs](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/configuration.html). If you rather use your own client instance, just pass it in here instead.
@@ -159,15 +158,15 @@ All of the above are valid. `workerFn2` and `asyncWorker` are likely to be more
## Queue events
`esqueue` components, namely the Queue, Job, and Worker instances, are also event emitters. Each instance will emit events to help your application know when certain things happen in the queue, like when a job is created, or a worker is done running, or when it times out.
`elastiq` components, namely the Queue, Job, and Worker instances, are also event emitters. Each instance will emit events to help your application know when certain things happen in the queue, like when a job is created, or a worker is done running, or when it times out.
It's important to note that all events emitted from the Job and Worker instances are also emitted on the Queue instance. This means that your application should be able to react to changes by only keeping track of that instance.
Available events can be found in `lib/constants/events.js`, and you're encouraged to import and use those constant values in your application. Here's an example:
```js
var Queue = require('esqueue');
var queueEvents = require('esqueue/lib/constants/events');
var Queue = require('elastiq');
var queueEvents = require('elastiq/lib/constants/events');
var jobQueue = new Queue('my-index');