@tradologics/queuet

0.0.9 • Public • Published

Dead Simple, Redis-Based, Message Broker for Node.js

npm Version npm Version Code Factor Star this repo Follow me on

Install

$ npm install @tradologics/queuet

Use

Publisher

const broker = require("@tradologics/queuet");

// connect to redis
broker.initialize("myqueue");

broker.publish("This is my message").then(resp => {
    broker.disconnect();
    process.exit(0);
}).catch(err => console.log(err));

Subscriber

(starts with getting the backlog)

const broker = require("queuet");

// connect to redis
broker.initialize("myqueue");

// handle backlog
broker.read_backlog(do_something);

// subscribe to new items
broker.subscribe(do_something);


function do_something(id, data) {
    console.log(">>", id, data);

    // do some processing here and remove
    // the message from the queue when done
    broker.delete(id);
};

Package Sidebar

Install

npm i @tradologics/queuet

Weekly Downloads

0

Version

0.0.9

License

Apache-2.0

Unpacked Size

136 kB

Total Files

12

Last publish

Collaborators

  • ranaroussi
  • 4doge
  • alexburykin