@pointblankdev/gather-scheduler
v0.1.1
Published
@pointblankdev/gather-scheduler is a wapper around the [agendajs](https://www.npmjs.com/package/agenda) package which returns a connected aganda instance to a mongodb service.
Downloads
4
Keywords
Readme
@pointblankdev/gather-scheduler
@pointblankdev/gather-scheduler is a wapper around the agendajs package which returns a connected aganda instance to a mongodb service.
Installation
yarn add @pointblankdev/gather-scheduler
Usage
import {Agenda} from "@pointblankdev/gather-scheduler"
# define a job and instatenoisly schedule the job
Agenda.define(
"send a reminder to get me ice-cream",
{ priority: "high", concurrency: 10 },
async (job) => {
const { to } = job.attrs.data;
await email.send({
to,
from: "[email protected]",
subject: "Get me ice-cream",
body: "You definately dont want to forget, smiles .....",
});
}
);
(async function () {
await agenda.start();
await Agenda.schedule("in 20 minutes", "send email report", {
to: "[email protected]",
});
})();
Checkout [agendajs](https://www.npmjs.com/package/agenda) for more about [agendajs](https://www.npmjs.com/package/agenda)