Created
May 16, 2013 15:41
-
-
Save haifeng/5592665 to your computer and use it in GitHub Desktop.
broker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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