Skip to content

Latest commit

 

History

58 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UpRingPubSub

npm version Build Status Coverage Status

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.

js-standard-style

Install

npm i upring-pubsub --save

Usage

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)
})

API

new UpRingPubSub(opts)

See MQEmitter for the actual API.

Acknowledgements

This project is kindly sponsored by nearForm.

License

MIT

About

PubSub system built on top of UpRing

Resources

Stars

18 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages