https://github.com/dadi/queue-wrapper
A high-level library for interacting with DADI Queue
https://github.com/dadi/queue-wrapper
Last synced: about 1 year ago
JSON representation
A high-level library for interacting with DADI Queue
- Host: GitHub
- URL: https://github.com/dadi/queue-wrapper
- Owner: dadi
- Created: 2016-08-02T12:46:04.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-12T09:56:24.000Z (over 3 years ago)
- Last Synced: 2025-03-29T10:33:30.305Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 421 KB
- Stars: 2
- Watchers: 9
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# DADI Queue Wrapper
A high-level library for interacting with [DADI Queue](https://github.com/dadi/queue)
[](https://www.npmjs.com/package/@dadi/queue-wrapper)
[](https://coveralls.io/github/dadi/queue-wrapper?branch=master)
[](https://travis-ci.org/dadi/queue-wrapper)
[](http://standardjs.com/)
## Overview
DADI Queue is a lightweight, high-performance task queue.
This library provides a simple wrapper for connecting and sending messages to the queue.
## Getting started
1. Install the **@dadi/queue-wrapper** module to your project:
`npm install @dadi/queue-wrapper --save`
2. Add the library and configure the options:
```javascript
const Queue = require('@dadi/queue-wrapper')
let queue = new Queue({
host: '127.0.0.1',
port: 6379,
name: 'myqueue'
})
```
3. Send a message:
```javascript
queue.send('hello-world', function (err, resp) {
if (err) console.log('oh no')
})
```
### Deferring messages
```javascript
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.