A high-level library for interacting with DADI Queue
DADI Queue is a lightweight, high-performance task queue.
This library provides a simple wrapper for connecting and sending messages to the queue.
-
Install the @dadi/queue-wrapper module to your project:
npm install @dadi/queue-wrapper --save
-
Add the library and configure the options:
const Queue = require('@dadi/queue-wrapper') let queue = new Queue({ host: '127.0.0.1', port: 6379, name: 'myqueue' })
-
Send a message:
queue.send('hello-world', function (err, resp) { if (err) console.log('oh no') })
let queue = new Queue({
...
deferred: {
messages: ['foo', 'bar:baz'],
start: '20:00',
stop: '02:00'
}
})
The options above will ensure that the queue will only begin processing messages starting with 'foo' and 'bar:baz' between 20:00 and 02:00 every day.