Repository navigation
Scheduler Updates
Updates to execute cron jobs in your Njs2 Projects
A new condition has been added to the default handler function which can now read the cron tasks and execute them based on the cron pattern mentioned in config.json
Documentation can be found in the below link:
cron
e.g.: say you want to execute a piece of code every 'n' minutes,
- Make a new entry with the required cron pattern in the config.json file
- Ask the DevOps team to make a AWS EventBridge Rule to have an EVERY MINUTE call to your Lambda function with just requestType = "cron" as the param
- Njs2 Framework should now check each cron entry in your Lambda Code > config.json file and if the cron pattern matches the current minute it shall execute the respective task
What if i want to upgrade my existing project to use this @njs2/base version?
- copy the cron.js, mCron.js files from HERE to the root of your project
- update your config.json as per this documentation
- install the latest @njs2/base version using: npm i @njs2/base@latest or npm i @njs2/base@2.2.0
- run the project locally and configure your crontab as per this documentation (unix based systems only!)