0.9.1 • Published 10 years ago

hapi-agenda v0.9.1

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

hapi-agenda

Installation

npm install hapi-agenda --save

Usage

server.register({
  register: require('hapi-agenda'),
  options: {
    mongoUrl: 'localhost:27017/hapi-agenda',
    jobs: __dirname + '/jobs', // path to directory containing job files
    processEvery: '5 seconds', // Defaults to 30 seconds. Lower numbers = higher db calls
    every: { // Runs these jobs
      '10 seconds': 'say-hello',
      '30 seconds': 'here is a task'
    }
  }
}, function(err) {
  // start server or other stuff
});

Job File:

Job name based on filename

hello-world.js

module.exports = function(data, done) {
  console.log('Hello world');
  done();
};

Job with options and custom name

customjob.js

module.exports = {
  name: 'here is a task',
  job: function(data, done) {
    console.log('hostname', this.info.host);
    done();
  },
  concurrency: 10,
  priority: 'high'
};
0.9.1

10 years ago

0.9.0

10 years ago

0.8.0

10 years ago

0.7.0

10 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.1

11 years ago

0.3.0

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago