0.0.27 • Published 8 years ago

recurry v0.0.27

Weekly downloads
4
License
GPL3
Repository
github
Last release
8 years ago

Recurry

recurrent REST call scheduler

Note: for delayed jobs please use a queue like kue

These days almost anything can be triggered using REST calls, so meet Recurry. Recurry does recurring REST calls, with a nice degree of (remote) control.

You can think of recurry as cron+flock on a unix platform, except without the files (but a REST interface).

Usage

$ npm install recurry coffee-script
$ echo '{"cache":{"scheduler":[],"timers":[]}}' > cache.json
$ RECURRY_CACHEFILE="cache.json" ./server

NOTE: Recurry supports persistance, but does not require a database (instead it uses a local jsonfile)

Hubot interface

Instead of fiddling with crontab-files, the recurry-hubot module allows hubot interfacing with the REST api:

  • starting, stopping, pausing, resuming recurring REST calls
  • adding and removing REST calls including payload

Make sure you run npm install recurry-hubot in your hubot rootdir, and get in control:

hubot> recurry

id           method  url                          payload  scheduler  triggered  triggered_last            status   timer
-----------  ------  ---------------------------  -------  ---------  ---------  ------------------------  -------  -----
ping         post    http://foo.com/ping          {}       1 minutes  1235       2015-06-12T13:35:49.173Z  start'd  {}   
pushjob      post    http://queue.foo.com/ping    {}       5 minutes  54         2015-06-12T13:35:49.173Z  start'd  {}   
flapjob      post    http://queue.foo.com/flap    {}       5 minutes  54         2015-06-12T13:35:49.173Z  start'd  {}   
...

JSON API

Documentation of API endpoints

GET /scheduler/remove/:id

stops and removes a scheduler

PUT /scheduler/trigger/:id

manually triggers a scheduler id

PUT /scheduler/action/:id

starts/stops/pauses/resumes a scheduler

Example payload:

 {
   "action": "pause"
 }

JSON Schema:

 {
   "type": "object",
   "properties": {
     "action": {
       "id": "http://recurry/scheduler/action",
       "type": "string",
       "required": true,
       "default": "pause",
       "enum": [
         "start",
         "stop",
         "pause",
         "resume",
         "trigger"
       ]
     }
   }
 }

PUT /scheduler/rule/:id

sets the scheduler

Example payload:

 {
   "scheduler": "5 minutes"
 }

JSON Schema:

 {
   "type": "object",
   "properties": {
     "scheduler": {
       "id": "http://recurry/scheduler",
       "type": "string",
       "required": true,
       "default": "5 minutes"
     }
   }
 }

GET /scheduler

returns complete content of scheduled jobs

POST /scheduler

allows posting of a job scheduler

Example payload:

 {
   "method": "post",
   "id": "call foo",
   "url": "http://foo.com/ping",
   "payload": {},
   "scheduler": "5 minutes"
 }

JSON Schema:

 {
   "type": "object",
   "properties": {
     "method": {
       "id": "http://recurry/method",
       "type": "string",
       "required": true,
       "enum": [
         "get",
         "post",
         "put",
         "delete",
         "options"
       ],
       "default": "post"
     },
     "id": {
       "id": "http://recurry/id",
       "type": "string",
       "default": "call foo"
     },
     "url": {
       "id": "http://recurry/url",
       "type": "string",
       "required": true,
       "default": "http://foo.com/ping"
     },
     "payload": {
       "id": "http://recurry/payload",
       "type": "object"
     },
     "scheduler": {
       "id": "http://recurry/scheduler",
       "type": "string",
       "default": "5 minutes"
     }
   }
 }

GET /scheduler/:id

get a scheduler object including payload

GET /scheduler/reset/:id

resets the 'triggered' counter of a scheduled job

PUT /payload/:id

updates (optional) specific arguments which will be passed to the job

0.0.27

8 years ago

0.0.26

8 years ago

0.0.25

8 years ago

0.0.24

8 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

9 years ago

0.0.20

9 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.133

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.1

9 years ago