Skip to content

tkyshm/delay

Repository files navigation

Build Status

delay

Simple delay job Application

Build

$ rebar3 compile

API

POST /api/enqueue

  • Content-Type: application/json
  • Post parameters
param description
exec_time exec_time is specified by unixtime (seconds). (optional)
webhook GET request to webhook when a job is finished. (optional)
data user job's parameters. (optional)
{
    "event": "event_name",
    "exec_time": 1488714710,
    "webhook": "hook_url",
    "data" : {
        "id": "xxx",
        "name": "kirito"
    }
}

GET /api/dequeue

  • Support long-polling
  • Request headers:
header value
X-Delay-Timeout Long-polling timeout (seconds).
  • Response:
[
  {
    "uid": "afcc27ac-3f03-4cdd-ad73-ddd9422b56d6",
    "data": {
      "name": "abc",
      "id": "12304"
    }
  },
  {
    "uid": "ad09e2c3-f14f-4c51-a8df-6b7a3b7ba3d6",
    "data": {
      "name": "defg",
      "id": "348593"
    }
  }
]

TODO:

  • enqueue
  • docker
  • mnesia
  • job worker
  • dequeue
  • long-polling
  • webhook
  • test code
  • ci
  • load test
  • document
  • cleans commit