Saturday, February 14, 2015

gearman and node.js

install

npm install node-gearman

https://www.npmjs.com/package/gearmanode

worker code example:


var nodejspath='/var/www/node_js/node_modules';
var gearmanode = require(nodejspath+'/gearmanode');
var worker = gearmanode.worker();

worker.addFunction('gcm_ca_nodejs', function (job) {
    console.log("got input as "+job.payload.toString());
    job.workComplete("done");
});


No comments:

Post a Comment