1.4.1 • Published 1 year ago

@vidiemme/adonis-scheduler v1.4.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

Adonis Scheduler

npm-image license-image typescript-image

This addon adds the functionality to schedule jobs managed via databases.

Introduction

This package leverages Lucid for database job management, it can be used with all types of databases supported by Lucid (MySQL, SQLite, Postgresql, ...). \ For some databases that support locking, the job lock function has been implemented so that, in case of multiple server instances, only one node takes over the job from the DB.

Installation

Install the package \ npm i @vidiemme/adonis-scheduler

Configure the package \ node ace configure @vidiemme/adonis-scheduler

Perform migration \ node ace migration:run

Usage

Make a job handler with the command node ace make:job << job name >>. \ Then you must record the list of your jobs in the map inside the file start/scheduler.ts.

e.g.:

import JobClass from 'App/Jobs/JobClass'

JobMap.set('jobName', JobClass)

The Job can work with any resource on the server. \ You can also pass metadata in Json format to the handle method.

interface MyCustomInterface {
    ...
}

public async
handle(params
:
MyCustomInterface
)
{
    // your job here
}

Jobs are managed directly in DB:

  • The name field must be aligned to the names entered in the JobMap.
  • the data field is optional and can contain a json of parameters to pass to the JobHandler
  • The cron field represents how often to run the job.
1.4.1

1 year ago

1.4.0

1 year ago

1.3.2

2 years ago

1.3.1

2 years ago

1.2.0

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago