Created
November 21, 2012 20:20
-
-
Save terrancesnyder/4127399 to your computer and use it in GitHub Desktop.
NodeJS ZeroMQ Consumer Example used with Issue #110 on ZMQ
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
var zmq = require('zmq') | |
, sock = zmq.socket('pull'); | |
// increase swap for high water mark | |
zmq.options.swap = 1024; | |
zmq.options.hwm = 0; | |
// zmq.options.rate = 800000; | |
sock.connect('tcp://127.0.0.1:3000'); | |
console.log('Worker connected to port 3000'); | |
sock.on('message', function(msg){ | |
if (+msg % 10000 == 0) { | |
console.log('work: %s', msg.toString()); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment