fpm-plugin-schedule

2.2.6 • Public • Published

FPM-PLUGIN-SCHEDULE

用于管理定时任务的插件

Install

npm i fpm-plugin-schedule --save

Basic Info

  • Run Action Hook Name: BEFORE_SERVER_START
  • ExtendModule Name: job
  • Exception
    • E.Job.JOB_CREATE_ERROR
      const E = {
        Job: {
          JOB_CREATE_ERROR: {
            errno: -10031, 
            code: 'JOB_CREATE_ERROR', 
            message: 'The args should be an object-like'
          }
        }
      }
  • getDependencies()
    • []
  • The Reference Of The Bind() Method An BizModule Object Contains The Belw Functions
    • createCronJob(args)
    • cancelJob(id:Number!)
    • getJobs
    • getJob(id:Number)
    • pauseJob(id:Number)
    • restartJob(id:Number)
    • callJob(id:Number)

Useage

Important

In Disk Mode It will create schedule.json after you create anyone job

In Mysql Mode It should connect a mysql server

Handle The Jobs' Result

You can call fpm.subscribe('#cronjob/done'); and the result in data.result You should call fpm.subscribe('#cronjob/error'); and the error in data.error

Webhook

Only support POST the JSON webhook!

You can add the webhook address when you create the schedule, it will be called after the job finished!

the arguments of the webhook should like

{
  code: 0/-1, // 0: ok, -1: error
  content: {}, // the result / error content.
}

Readme

Keywords

none

Package Sidebar

Install

npm i fpm-plugin-schedule

Weekly Downloads

8

Version

2.2.6

License

ISC

Unpacked Size

59 kB

Total Files

16

Last publish

Collaborators

  • yfsoftcom