A queuing system for Koop
JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
src
test
.babelrc
.flowconfig
.gitignore
.npmignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
package.json

README.md

Koop-Queue

A queuing system for Koop

npm travis

Installation

As a package

npm install koop-queue

From source

git clone https://github.com/koopjs/koop-queue.git
cd koop-queue
npm install
npm install -g babel-cli
npm run compile

Usage

As a Koop Plugin

const Koop = require('koop')
const config = require('config')
const koop = Koop(config)
const Queue = require('koop-queue')

// koop will instantiate an instance of Queue
koop.register(Queue)

Standalone

const Queue = require('koop-queue')

const connection = {
  host: '127.0.0.1',
  port: 6379,
  prefix: 'koop-jobs'
}

const queue = new Queue()

const options = {
  table: '1ef:0',
  format: 'csv',
  key: 'J2E4QvGLBHgX',
  name: 'trees',
  path: './output'
}

// returns an event emitter
const job = queue.enqueue('xport', options)

job
.on('error', e => console.log(e))
.on('start', () => console.log('Job started'))
.on('progress', progress => console.log(progress))
.on('finish', () => console.log('Job finished'))

Configuration

In config/:env.json

Note: all connection configs are optional

{
  "queue": {
    "connection": {
      "host": "127.0.0.1",
      "port": 6379,
      "namespace": "koop-jobs",
      "database": 0
    }
  }
}