Skip to content

Node.js module that provides unified pub-sub API for message broker of your choice: Redis, RabbitMQ (AMQP), ActiveMQ (STOMP)

License

Notifications You must be signed in to change notification settings

latysheff/node-metabroker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

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

About

Node.js module that provides unified pub-sub API for message broker of your choice: Redis, RabbitMQ (AMQP), ActiveMQ (STOMP)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published