![license](https://img.shields.io/github/license/ladjs/agenda.svg)
Agenda for Lad
Table of Contents
Install
npm:
npm install @ladjs/agenda
yarn:
yarn add @ladjs/agenda
Usage
This package serves as a drop-in replacement for a normal Agenda require()
call. It carries the same exact API and returns the same Agenda instance that it normally would (except it adds some extra glue on top, such as built-in integration of stop-agenda).
Default options are shown below:
#!/usr/bin/env node
const Agenda = require('@ladjs/agenda');
const mongoose = require('@ladjs/mongoose');
const Graceful = require('@ladjs/graceful');
const agenda = new Agenda();
agenda.configure({
logger: console,
stopAgenda: {
cancelQuery: {
repeatInterval: {
$exists: true,
$ne: null
}
}
},
agendaJobDefinitions: [],
agendaRecurringJobs: [],
agendaBootJobs: []
});
mongoose.configure({
...config.mongoose,
logger,
agenda
});
mongoose
.connect()
.then(() => {
agenda.start();
})
.catch(logger.error);
const graceful = new Graceful({
mongoose,
agenda,
logger
});
graceful.listen();
Contributors
License
MIT © Nick Baugh