PubSub system built on top of an UpRing consistent hashring.
You will get a pubsub system that is consistently available, so it can lose messages when the topology changes.
However, it is massively scalable.
npm i upring-pubsub --save
const upring = require('upring')({
base: process.argv.slice(2),
hashring: {
joinTimeout: 200
}
})
upring.use(require('upring-pubsub'))
var count = 0
upring.on('up', function () {
console.log('copy and paste the following in a new terminal')
console.log('node example', this.whoami())
upring.pubsub.on('hello/world', function (msg, cb) {
console.log(msg)
cb()
})
setInterval(function () {
count++
upring.pubsub.emit({
topic: 'hello/world',
count,
pid: process.pid
})
}, 1000)
})
See MQEmitter for the actual API.
This project is kindly sponsored by nearForm.
MIT