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.
npm install metabroker
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)
returns Broker instance
callback(message)
Copyright (c) 2018 Vladimir Latyshev
License: MIT