summaryrefslogtreecommitdiff
path: root/tests/jobs_ok.php
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-08-11 22:03:34 +0300
committerValery Piashchynski <[email protected]>2021-08-11 22:03:34 +0300
commit2d460062c97f9ad1e793831c54ae4d177dea83e8 (patch)
treed796a11941fab4be668843a3fcbd83ea0859db39 /tests/jobs_ok.php
parente855ae9fe5673bd95f45f9a265259cb5ecdc9f81 (diff)
Durable requeue algo. Update AMQP and Beanstalk tests to use mock
logger. Fix bugs discovered during testing. Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests/jobs_ok.php')
-rw-r--r--tests/jobs_ok.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/jobs_ok.php b/tests/jobs_ok.php
new file mode 100644
index 00000000..fa58dd9a
--- /dev/null
+++ b/tests/jobs_ok.php
@@ -0,0 +1,32 @@
+<?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' => [
+ 'message' => 'error',
+ 'requeue' => true,
+ 'delay_seconds' => 10,
+ 'headers' => $headers
+ ]
+ ])));
+ } catch (\Throwable $e) {
+ $rr->error((string)$e);
+ }
+}