New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

metabroker

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metabroker

Unified pub-sub API for message broker of your choice: Redis, RabbitMQ (AMQP), ActiveMQ (STOMP)

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

Simple publish-subscribe API for several message brokers: Redis, RabbitMQ (AMQP), ActiveMQ (STOMP).

Application can utilize unified pub-sub interface and easily switch from one broker to another.

Actual modules implementing protocols are:

  • redis
  • amqp-connection-manager which itself is a wrapper for amqplib
  • stomp-client

Module automatically reconnects and resubscribes in case of broker failure.

Installation

npm install metabroker

Example

const metabroker = require('metabroker')
let url = 'redis://10.192.171.251:6379'
const broker = metabroker.connect(url, () => {
  console.log('connected', url)
})
broker.subscribe('test_queue', message => {
  console.log('received:', message)
})
setInterval(() => {
  broker.publish('test_queue', new Date())
}, 1000)

API

connect([url, ][connectListener])

returns Broker instance

Broker

broker.subscribe(queue, callback)

callback(message)

broker.publish(queue, message[, headers])

broker.disconnect()

Author

Copyright (c) 2018 Vladimir Latyshev

License: MIT

Keywords

pub-sub

FAQs

Package last updated on 12 Feb 2018

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