2.2.6 • Published 5 years ago

fpm-plugin-schedule v2.2.6

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

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.
}
2.2.6

5 years ago

2.2.5

5 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago