Simplest task management module.
npm i taskr --save
var queue = require('taskr')({
handlers: __dirname + '/tasks', // load each module as task and name each one (task) after corresponding module
hooks: {
before: function (task, params) { console.log('started task', task, params); },
after: function (task, params, result) { console.log('finished task', task, params, result); }
exception: function (task, params, exception) { console.log('failed task', task, params, exception); }
},
piping: {
'after task': 'do this task',
'after task which returns array': ['process each item of resulting array'],
'after task': ['start', 'multiple', 'tasks', 'immediately']
},
schedule: {
'my periodic task runs each 30 seconds': '*/30 * * * * *',
'this one takes args': { '2 * * * * *': 'wow!' }
'this one takes args, now with multiple schedules': { '2 * * * * *': '2 seconds', '5 * * * * *': '5 secs' }
}
});
queue.start('start this immediately', { param: 10 });
MIT