Skip to content

Instantly share code, notes, and snippets.

@haifeng
Created May 16, 2013 15:41
Show Gist options
  • Save haifeng/5592665 to your computer and use it in GitHub Desktop.
Save haifeng/5592665 to your computer and use it in GitHub Desktop.
broker
brokerListener = zmq.socket('pull')
brokerListener.identity = 'Broker Listener:' + process.pid
brokerListener.connect(nconf.get('busUri'))
console.log("#{brokerListener.identity} created.")
brokerListener.on('message', (type, data) ->
console.log("Broker Listener " + brokerListener.identity + ': received type' + type + ', data [' + data.toString() + ']')
switch type
when 'ImageProcessor'
imageProcessor.send(data)
else
articleProcessor.send(data)
)
imageProcessorBus = zmq.socket('push')
imageProcessorBus.identity = 'imageProcessor Bus:' + process.pid
imageProcessorBus.bind(nconf.get('imageProcessorPort'))
console.log("#{imageProcessorBus.identity} created")
articleProcessorBus = zmq.socket('push')
articleProcessorBus.identity = 'articleProcessor Bus:' + process.pid
articleProcessorBus.bind(nconf.get('articleProcessorPort'))
console.log("#{articleProcessorBus.identity} created")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment