Last active
October 22, 2015 20:42
-
-
Save wonderdogone/75a7dce4527044a4fddb to your computer and use it in GitHub Desktop.
This file contains 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
const cluster = require('cluster'); | |
if (cluster.isMaster) { | |
let router = zmq.socket('router').bind('tcp://127.0.0.1:5433'); | |
// forward messages between router and dealer | |
router.on('message', function() { | |
//send to worker | |
}); | |
for (let i = 0; i < 4; i++) { | |
cluster.fork(); | |
} | |
} else { | |
let worker = zmq.socket('rep').connect('ipc://filer-dealer.ipc'); | |
worker.on('message', function(data) { | |
//dowork | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment