npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

querator

v0.0.3

Published

Universal NodeJS wrapper for working with RabbitMQ, Redis pub/sub, Kafka and other message queues

Downloads

10

Readme


ATTENTION!

The library is under development. For reference only.
The NPM package has all the latest changes, you can check the functionality in the current state.

We also ask everyone who considers this project interesting and promising to put star on github! Also, you can help raise awareness of this library and share it on social media so that more people know about it. Thank you!

WELCOME TO CONTRIBUTORS!

Universal NodeJS wrapper for working with RabbitMQ, Redis pub/sub, Kafka and other message queues.


Motivation


Distributed systems are already practically the standard for modern application development. Message queues are a key link in such systems. At the same time, there are a lot of technologies that implement message queues, and choosing the right technology is a rather difficult task, and switching to another technology during the life cycle of an application brings with it a lot of overhead.

Querator implements a universal API for various message brokers such as RabbitMQ, Redis pub /sub, Kafka, ZeroMQ, MQTT and others.


Engines


  • RabbitMQ <- amqplib
  • Redis <- redis
  • Kafka <- kafkajs (not ported yet). HELP WANTED
  • MQTT <- MQTT.js (not ported yet). HELP WANTED
  • ZeroMQ <- zeromqjs (not ported yet). HELP WANTED

Run engine for testing

RabbitMQ

$ docker run -d --hostname my-rabbit --name some-rabbit rabbitmq:3-management

More info

Redis

$ docker run --name some-redis -d redis redis-server

More info


How it works


In addition to certain patterns, all message queues follow the Publisher/Subscriber pattern. Querator hides the specific logic and methods of popular message queuing libraries and provides a single interface that makes it very easy to replace a previously chosen engine with another one.

Querator uses dynamic imports so you can be sure that only the selected engine is loaded.

For ease of use, we have added the ability to load the message broker configuration from a file of any of the popular formats: json, yaml, toml.


Usage


install

npm install querator

or

yarn add querator

Manual settings

import { Querator } from 'querator'

const main = async () => {
  const broker = new Querator({
    engine: 'redis',
    settings: {} // settings from engine library docs or empty for default settings
  })

  await broker.connect()

  await broker.receive('test', (msg) => {
    console.log(msg)
  })

  await broker.receive('test2', (msg) => {
    console.log(msg)
  })

  setInterval(async () => {
    await broker.publish('test', 'test')
    await broker.publish('test2', 'test2')
  }, 1000)
}

main()

Parse settings from file

import { Querator } from 'querator'

const main = async () => {
  const broker = new Querator({
    engine: 'rabbitmq',
    file: './config/rabbit_config.json' // .yaml, .yml, .toml
  })

  await broker.connect()

  await broker.receive('test', (msg) => {
    console.log(msg)
  })

  await broker.receive('test2', (msg) => {
    console.log(msg)
  })

  setInterval(async () => {
    await broker.publish('test', 'test')
    await broker.publish('test2', 'test2')
  }, 1000)
}

main()

Roadmap


For v1 release

  • add cluster settings
  • add specific methods for some engines
  • add schemas to validate engines settings
  • add ping method
  • add docs
  • 90%+ test coverege

Contributing


This library is fully supported by the community. If you can offer any help, then welcome to the team!

Please use StandardJS for code formatting and linting.