Skip to content

Instantly share code, notes, and snippets.

@terrancesnyder
Created November 21, 2012 20:20
Show Gist options
  • Save terrancesnyder/4127399 to your computer and use it in GitHub Desktop.
Save terrancesnyder/4127399 to your computer and use it in GitHub Desktop.
NodeJS ZeroMQ Consumer Example used with Issue #110 on ZMQ
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