Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Latest commit 44e6657 @possan Updated readme with examples
Failed to load latest commit information.
examples Added examples, moved code into reusable module
lib Updated package Updated readme with examples
package.json Updated package

Node.js service broker and provisioner

Simple scalable example setup

  • one or more provisioning servers (examples/provisioner.js)
  • one or more service proxies per provisioning server (examples/proxy.js)
  • multiple clients (examples/trigger.js)
  • a pubsub-capable messagebus (redis implementation included)

Typical client workflow

  1. client picks a random channel name.
var commchannel = 'mycomm/' + uuid.v1();
  1. client tells the provisioner that it expects a specific service running on that channel.
bus.publish('provisioner', { 
    type: 'provision',
    service: 'randomnumberservice',
    channel: commchannel
  1. provisioner then tells one of all available proxies to start that service up on that channel.

  2. client talks directly to service on selected channel.

bus.subscribe(commchannel, function (chan, msg) {
    console.log('message from service:', msg);

bus.publish(commchannel, {
    action: 'something',

Writing services is also simple

This is a sample service reporting random values back at given intervals to the client, and listens for an killsignal which stops it.

var commchannel = process.argv[2]; // channel name is first argument 
console.log('## Sample service - communicating on channel '+commchannel);

bus.subscribe(commchannel, function (chan, msg) {
    if (msg.type == 'stop-service')

setInterval(function () { 
    bus.publish( commchannel, { type:'data', value:Math.random()*1000 } );
}, 2000);
Something went wrong with that request. Please try again.