Questions tagged [agenda]

Agenda is a light-weight job scheduling library for Node.js, with a Mongo persistence layer.

Agenda is a light-weight job scheduling library for Node.js.

It offers:

  • Minimal overhead. Agenda aims to keep its code base small.
  • Mongo backed persistance layer.
  • Promises based API
  • Scheduling with configurable priority, concurrency, and repeating
  • Scheduling via cron or human readable syntax.
  • Event backed job queue that you can hook into.
  • Optional standalone web-interfaces (see agendash and agenda-ui)

Installation

Install via NPM

npm install agenda

You will also need a working mongo database (2.6+) to point it to.

Example Usage

var mongoConnectionString = "mongodb://127.0.0.1/agenda";

var agenda = new Agenda({db: {address: mongoConnectionString}});

// or override the default collection name:
// var agenda = new Agenda({db: {address: mongoConnectionString, collection: "jobCollectionName"}});

// or pass additional connection options:
// var agenda = new Agenda({db: {address: mongoConnectionString, collection: "jobCollectionName", options: {server:{auto_reconnect:true}}}});

// or pass in an existing mongodb-native MongoClient instance
// var agenda = new Agenda({mongo: myMongoClient});

agenda.define('delete old users', function(job, done) {
  User.remove({lastLogIn: { $lt: twoDaysAgo }}, done);
});

agenda.on('ready', function() {
  agenda.every('3 minutes', 'delete old users');

  // Alternatively, you could also do:
  agenda.every('*/3 * * * *', 'delete old users');

  agenda.start();
});

More Info:

https://github.com/agenda/agenda

98 questions
1
vote
0 answers

How to add events to an in app calendar using React-Native-Calendar?

I have built an in app calendar using react-native calendar, and I want the user to be able to add or delete appointments to the calendar, but cannot figure this part out. The user will be allowed to schedule up to a week in advance. How should I go…
MK_Pierce
  • 916
  • 2
  • 10
  • 26
1
vote
1 answer

Task defined by users with AgendaJS

I want to generate tasks defined by users. Basically they have some inputs ex: dropdown with weekDays when they want the cron to run, startDate and timezone. This tasks are defined for projects. On the project they define when they want to create…
paratif
  • 11
  • 1
1
vote
0 answers

Agenad job is not getting start again after nodejs (express) server restart

I am using node agenda while scheduling I am able to successfully save job and its running fine. But while restarting the server the previous jobs are not getting start again. Not sure why, I tried few solutions found online but unable to make it…
Tech Nerd
  • 93
  • 3
  • 11
1
vote
0 answers

Nodejs agenda job scheduler - How to group multiple jobs that will run in the same database scan into 1 batch job?

Problem I have purchase service that users can use to buy/rent digital assets like game, media, movies... When purchase event happened, I create a job and schedule it to run at calculated expired date to remove key for such asset. Everything works.…
1
vote
1 answer

Stub Node.js utility function called from a callback (Sinon and Agenda)

I'm using agenda for background jobs and I'm trying to test the define method to ensure 1.) agenda.define is called and 2.) a method inside of agenda.define (triggerSend) is called. I've included the four files I'm using to make this test: 1.) the…
Danny Beyrer
  • 51
  • 1
  • 7
1
vote
1 answer

Agenda | TimeoutOverflowWarning

Node.js Version: v12.13.1. OS: Microsoft Windows 10 Pro, Version: 10.0.18362 Build 18362 NPM packages: "agenda": "^2.0.2", "appmetrics-dash": "^5.0.0", "avro-schema-registry": "^1.5.1", "avsc": "^5.4.16", "await-to-js": "^2.1.1", "bluebird":…
1
vote
1 answer

Convert NodeJS agenda ready event anonymous function to normal function

I'm using NodeJS Agenda module for job scheduling. In agenda there is an event 'ready' module.exports = function(agenda) { agenda.define('test', function(job, done) { }); agenda.on('ready', function() { agenda.every('*/5 * * * * *', 'test'); …
Dev
  • 413
  • 10
  • 27
1
vote
0 answers

Agenda not running jobs on schedule

I am trying to use agenda to schedule jobs at a certain date and time, but the jobs are not running when the specified date is reached. This is how I'm creating the job: agenda.create(type, data) .schedule(new Date(startDate)) .repeatEvery('11 21 *…
Valip
  • 4,440
  • 19
  • 79
  • 150
1
vote
1 answer

Write unit test for NodeJs agenda job processor

I'm using agenda framework for job scheduling link https://github.com/agenda/agenda Scheduling a job it sends email to user, it's working fine, but I want to write unit test for current code. Any help appreciated this jobs runs as process for…
Dev
  • 413
  • 10
  • 27
1
vote
1 answer

Agenda Job: now() make the job running multiple times

I am scheduling an Agenda Job as below: await agenda.now("xyz"); But the above command makes my job running almost every 1 minute. But when I change it to await agenda.every('5 minutes', "xyz"); The above works as expected i.e. it runs the job…
Amit
  • 33,847
  • 91
  • 226
  • 299
1
vote
1 answer

Agenda job doesn't run after server restart

I have an Agenda job that runs perfectly fine when I define it for the first time. I can see the corresponding document in MongoDB and all is well. But when the server restarts or I press 'Ctrl+C' and terminate the process so after re-running my…
Sarmad
  • 303
  • 3
  • 16
1
vote
1 answer

Finding specific job using agendajs

First, I'm very new to NoSQL databases so pardon me if I'm using some wrong terminology. I'm using the agendajs module to store reminders in a Mongo database (required). Since all the reminders have the same job name ('send reminder'), and I'm not…
sb9
  • 266
  • 7
  • 22
1
vote
0 answers

react-native weekly agenda calendar with persian (jalali) support

I need weekly agenda calendar in persian for my app but I did not find any. I want to know that is there any weekly agenda calendar exists with persian support?
1
vote
1 answer

Agenda/Cron repeat after every 2 week on monday and tuesday

Does agenda/cron support repeat for this scenario? example : repeat a job every 2 week on monday and tuesday, i am able to repeat a job every 2 week but not a particular days, if yes what will be the expression of time interval. Both week and days…
naruto
  • 327
  • 1
  • 11
1
vote
1 answer

Adding a Slide at the beginning of a section

I am trying to code an automatic agenda/table of contents generator in VBA for PowerPoint, which generates agenda bullet points based on the titles of the sections inside the PowerPoint presentation. Since I also want the agenda to appear at the…
Phil_Smith
  • 35
  • 6