0.0.3 • Published 7 years ago

hooq v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

hooq

Hooq queueing library - for use with Hooq Queues.

Installing

npm install hooq --save

Using

The library automatically sets up a interval that watches for new items on the queue.

var hooq = require('hooq');

var queueProcessor = new hooq(
    {
        apiKey: 'Your API Key',
        queueKey: 'Your queue key',
    }
);

queueProcessor.watch(
    function (webhook, done) {
        console.log("Message received!");
        console.log(webhook);
        done();
    },
    function () {
        console.log("No messages");
    },
    function (err) {
        console.log("There has been an error", err);
    }
);

Methods

new Hooq(options)

Used to setup the Hooq library.

watch(haveMessageCallback, noMessageCallback, errorCallback)

Called when a response comes back

haveMessageCallback(message, done)

Call done() when you've finished processing an item to avoid reprocessing it.

noMessageCallback()

Called when no new items

errorCallback(error)

Called when there's been an error

Options

Options are passed in when creating your Hooq object

Required

  • apiKey - Your API key
  • queueKey - Your queue key

Optional

  • interval - How often to check for new items, in seconds (default 5 seconds, min 1 second)
  • take - Number of items to get at a time (default 1)
  • timeout - How long the items should stay hidden in the queue before appear again (default 5 minutes)
  • server - Hooq server URL
  • protocol - Protocol to use (http/https)
0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago