JSPM

  • Created
  • Published
  • Downloads 2432
  • Score
    100M100P100Q117614F
  • License MIT

A simple high-performance Redis message queue for Node.js.

Package Exports

  • redis-smq
  • redis-smq/dist/index.cjs
  • redis-smq/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (redis-smq) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

RedisSMQ

A simple high-performance Redis message queue for Node.js.

RedisSMQ

Tests Code quality Coverage Status NPM version NPM downloads

RedisSMQ is a Node.js library for queuing messages (aka jobs) and processing them asynchronously with consumers. Backed by Redis, it allows scaling up your application with ease of use.

Features

RedisSMQ Use Case: Multi-Queue Producers & Multi-Queue Consumers

 

RedisSMQ Overview

What's new?

🚀 RedisSMQ v8 is coming soon!

Installation

Currently, RedisSMQ is going under heavy development. Pre-releases at any time may introduce new commits with breaking changes. To view the latest release reference see RedisSMQ v7.2.3

npm i redis-smq@rc

Considerations:

  • Minimal Node.js version is >= 18 (RedisSMQ is tested under current active LTS and maintenance LTS Node.js releases).
  • Minimal Redis server version is 4.0.0.

Usage

RedisSMQ provides 3 classes in order to work with the message queue: Message, Producer, and Consumer.

Producers and consumers exchange data using one or multiple queues that may be created using the Queue Class.

A queue is responsible for holding messages which are produced by producers and are delivered to consumers.

Creating a queue

const { Queue, EQueueType } = require('redis-smq');

const queue = new Queue();

// Creating a LIFO queue
queue.save('my_queue', EQueueType.LIFO_QUEUE, (err) => console.log(err));

Producing a message

const { Producer, Message } = require('redis-smq');

const producer = new Producer();

const message = new Message();
message.setQueue('my_queue').setBody('Hello Word!')

producer.produce(message, (err) => console.log(err));

Consuming a message

const { Consumer } = require('redis-smq');

const consumer = new Consumer();
const messageHandler = (message, cb) => {
  console.log(message.getBody());
  cb();
}
consumer.consume('my_queue', messageHandler, (err) => console.log(err));

Documentation

See RedisSMQ Docs for more details.

Contributing

So you are interested in contributing to this project? Please see CONTRIBUTING.md.

License

MIT