@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: "example@example.com",
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: "anyone@example.com",
});
})();
Checkout [agendajs](https://www.npmjs.com/package/agenda) for more about [agendajs](https://www.npmjs.com/package/agenda)