Skip to content

Latest commit

 

History

History
74 lines (59 loc) · 3.49 KB

README.md

File metadata and controls

74 lines (59 loc) · 3.49 KB

RedisSMQ

A High-Performance Redis Simple Message Queue for Node.js

Build Code Quality Code Coverage Latest Release Downloads

Key Features

Use Cases

  • Managing background tasks, such as email sending or data processing.
  • Efficiently scheduling and retrying tasks.
  • Communication between multiple services in microservices architectures.
  • Handling real-time events in gaming, IoT, or analytics systems.

Installation and Usage

To get started with RedisSMQ, you can install the library using npm:

npm i redis-smq@rc

Create a queue, produce a message, and consume it using the provided classes and methods:

// Creating a queue
const queue = new Queue();
queue.save('my_queue', EQueueType.LIFO_QUEUE, EQueueDeliveryModel.POINT_TO_POINT, (err) => {
    if (err) console.error(err);
});

// Producing a message
const msg = new ProducibleMessage();
msg.setQueue('my_queue').setBody('Hello Word!');
producer.produce(msg, (err, ids) => {
    if (err) console.error(err);
    else console.log(`Produced message IDs are: ${ids.join(', ')}`);
});

// Consuming a message
const consumer = new Consumer();
const messageHandler = (msg, cb) => {
    console.log(msg.body);
    cb(); // Acknowledging
};
consumer.consume('my_queue', messageHandler, (err) => {
    if (err) console.error(err);
});

Documentation

For more information, visit the RedisSMQ Docs.

Contributing

Interested in contributing to this project? Please check out our CONTRIBUTING.md.

License

RedisSMQ is released under the MIT License.