summaryrefslogtreecommitdiff
path: root/plugins/jobs/response_protocol.md
blob: 77c78cb817fd4d9a909cd7edc44a03344c7312be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Response protocol used to communicate between worker and RR. When a worker completes its job, it should send a typed
response. The response should contain:

1. `type` field with the message type. Can be treated as enums.
2. `data` field with the dynamic response related to the type.

Types are:

```
0 - NO_ERROR
1 - ERROR
2 - ...
```

- `NO_ERROR`: contains only `type` and empty `data`.
- `ERROR` : contains `type`: 1, and `data` field with: `message` describing the error, `requeue` flag to requeue the
  job,
  `dalay_seconds`: to delay a queue for a provided amount of seconds, `headers` - job's headers represented as hashmap with string key and array of strings as a value.

For example:

`NO_ERROR`:
For example:

```json
{
    "type": 0,
    "data": {}
}

```

`ERROR`:

```json
{
    "type": 1,
    "data": {
        "message": "internal worker error",
        "requeue": true,
        "headers": [
            {
                "test": [
                    {
                        "ttt": "11",
                        "ggg": "22"
                    }
                ],
                "test2": "2"
            }
        ],
        "delay_seconds": 10
    }
}
```