@amokrushin/redis-queue

[![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

Usage no npm install needed!

<script type="module">
  import amokrushinRedisQueue from 'https://cdn.skypack.dev/@amokrushin/redis-queue';
</script>

README

redis-queue

NPM Stable Version Build Status Test Coverage Dependency Status Node.js Version License

WIP

Install

npm i @amokrushin/redis-queue

RedisQueue

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.