Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@modulus/rabbit-pubsub

Package Overview
Dependencies
Maintainers
7
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@modulus/rabbit-pubsub

amqplib wrapper for easier rabbitmq scripting of pub/sub model

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
7
Created
Source

Rabbit-PubSub

version build license

amqplib wrapper for easier rabbitmq scripting of pub/sub model

Install

npm install @modulus/rabbit-pubsub

Usage

RabbitPubSub(url, [options])

The exported function takes the same parameters as amqplib.connect, and returns a object with two exported functions, publish and subscribe.

Publish(exchange, message, done)

Sends data to subscribers and yields.

const PubSub = require('@modulus/rabbit-rpc')(url)

PubSub.publish('tasks', { message: true }, (err, result) => {
  if (err) throw err // unable to publish

  console.log('message delivered')
})
Subscribe(exchange, worker)

Consumes messages on subscribed topics and passes them to worker. When worker calls done acknowledges the message and sends the result to the client.

const PubSub = require('@modulus/rabbit-rpc')(url)

PubSub.subscribe('tasks', (msg, done) => {
  // do work
  done(null, { result: true })
})

Contribute

Contributions welcome! Please read the contributing guidelines first.

Keywords

FAQs

Package last updated on 12 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc