Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vodolaz095/nervecord
The hord nervous system for nodeJS application, redis backended.
https://github.com/vodolaz095/nervecord
Last synced: about 4 hours ago
JSON representation
The hord nervous system for nodeJS application, redis backended.
- Host: GitHub
- URL: https://github.com/vodolaz095/nervecord
- Owner: vodolaz095
- License: mit
- Created: 2013-07-10T22:54:08.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-12-24T17:13:06.000Z (almost 9 years ago)
- Last Synced: 2024-11-01T11:37:36.529Z (15 days ago)
- Language: JavaScript
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
nervecord
====The cord nervous system for nodeJS application, redis backended.
Example
====```javascript
var NerveCord = require('nervecord');
var cluster = new NerveCord({
'host': 'localhost',
'port': 6379,
'prefix': 'nervecord'
});var workerSum = cluster.createWorker('sum', function (payload, done) {
setTimeout(function () {
done(null, (0 + payload.a + payload.b));
}, (Math.random() * 1000));});
workerSum.on('start_job',function(jobId){
console.log('Worker_sum starts job '+jobId)
});workerSum.on('complete_job',function(jobId){
console.log('Worker_sum completes job '+jobId)
});
workerSum.start();var workerMul = cluster.createWorker('mul', function (payload, done) {
setTimeout(function () {
done(null, (0 + payload.a * payload.b));
}, (Math.random() * 1000));
});
workerMul.on('start_job',function(jobId){
console.log('Worker_mul starts job '+jobId)
});workerMul.on('complete_job',function(jobId){
console.log('Worker_mul completes job '+jobId)
});
workerMul.start();var master = cluster.createMaster();
setInterval(function () {master.createTaskAndWait('sum', {a: 2, b: 3}, function (err, jobDone) {
if (err) {
throw err;
}
console.log(jobDone);
});master.createTaskAndWait('mul', {a: 2, b: 3}, function (err, jobDone) {
if (err) {
throw err;
}
console.log(jobDone);
});
}, 1000);```
Test
=========[![Build Status](https://travis-ci.org/vodolaz095/nervecord.png?branch=master)](https://travis-ci.org/vodolaz095/nervecord)
```
$ npm install should
$ npm install mocha
$ npm test
```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/vodolaz095/nervecord/trend.png)](https://bitdeli.com/free "Bitdeli Badge")