NDAX-RESQUE Library
This library is using actionhero/node-resque: Node.js Background jobs backed by redis. (github.com) package and is used to have more control over the cron jobs across all microservices
Setup
First you need to extend the abstrac class and pass the redisconfig, service name, and cron time in super
Second you need to overwrite the execute method with what ever method you want to run
Finally You must handle queues, worker, and scheduler upon module init and destroy.
async onModuleDestroy(): Promise<void> {
await this.end();
}
async onModuleInit(): Promise<void> {
await this.start();
}
Key Features
The main reason for using this library is we can monitor the status or cron , as this library will put events of the worker, queue, and scheduler in redis. And in future its possible to add functionality that allows us to have even more control over these queues, worker, scheduler