1.0.1 • Published 1 year ago

@walletswise/resq v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

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();
    }

See below for full example: full example

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