summaryrefslogtreecommitdiff
path: root/tests/jobs_ok.php
blob: 4e786d151be35ccfa739dea1ca4eb60702165d1b (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
<?php

/**
 * @var Goridge\RelayInterface $relay
 */

use Spiral\Goridge;
use Spiral\RoadRunner;
use Spiral\Goridge\StreamRelay;

require __DIR__ . "/vendor/autoload.php";

$rr = new RoadRunner\Worker(new StreamRelay(\STDIN, \STDOUT));

while ($in = $rr->waitPayload()) {
    try {
        $ctx = json_decode($in->header, true);
        $headers = $ctx['headers'];

        $rr->respond(new RoadRunner\Payload(json_encode([
            'type' => 0,
            'data' => []
        ])));
    } catch (\Throwable $e) {
        $rr->error((string)$e);
    }
}