@amokrushin/redis-queue
v0.1.10
Published
[![NPM Stable Version][npm-stable-version-image]][npm-url] [![Build Status][travis-master-image]][travis-url] [![Test Coverage][codecov-image]][codecov-url-master] [![Dependency Status][david-image]][david-url-master] [![Node.js Version][node-version-imag
Downloads
25
Readme
redis-queue
WIP
Install
npm i @amokrushin/redis-queue
RedisQueue
- RedisQueue
- new RedisQueue(createClient, [options])
- instance
- .enqueue(payload) ⇒ Promise
- .dequeue() ⇒ Promise
- .cancel()
- static
new RedisQueue(createClient, [options])
Creates a RedisQueue instance
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| createClient
| function
| | Function returning Redis instance. |
| [options.pollTimeout]
| number
| 10000
| Force subscriber to poll a queue for a new item. Timer restarts every time after new item was enqueued. |
| [options.notificationsChannel]
| string
| __redis-queue_notifications__
| |
redisQueue.enqueue(payload) ⇒ Promise<>
Enqueue new message to a queue.
| Param | Type | Description |
| --- | --- | --- |
| payload | any
| Any serializable payload. The payload is serialized using the .serialize() method. |
redisQueue.dequeue() ⇒ Promise<Object|null>
Dequeue message from a queue.
Returns: Promise<Object>
| Property | Type | Description |
| --- | --- | --- |
| id
| string
| Message identyfier |
| payload
| any
| The payload deserialized using the .deserialize() method. |
| ack
| function
| The function should be called if message processing was failed. |
| nack
| function
| The function should be called if message processing was succesful. |