agenda module example for Node.js [npmawesome and nodejitsu]

Forked from Hello World for Node.js.

361 Runs 564 Views 192 Copies
Saved

Saved

alexgorbatchev 22

alexgorbatchev
published 7 months ago

Agenda = require('agenda');

var agenda = new Agenda({db: {address: 'localhost:27017/agenda-example'}});

agenda.define('greet the world', function(job, done) {
  console.log(job.attrs.data.time, 'hello world!');
  done();
});

agenda.schedule('in 10 seconds', 'greet the world', {time: new Date()});
agenda.start();

console.log('Wait 10 seconds...');

Terminal

Your session has timed out.

Dismiss (the page may not function properly).