|
|
@ -22,24 +22,20 @@ class Consumer extends Command |
|
|
|
public function handle() |
|
|
|
{ |
|
|
|
$time = -microtime(true); |
|
|
|
echo PHP_EOL; |
|
|
|
|
|
|
|
$handler = function (ConsumableMessage $message, AMQPMessage $otherMessage) use (&$counter) { |
|
|
|
$m = $otherMessage->getBody(); |
|
|
|
echo PHP_EOL; |
|
|
|
echo PHP_EOL; |
|
|
|
dump(\strcmp($m, "finish"), $m, "finish"); |
|
|
|
if (\strcmp($m, "finish") === 0) { |
|
|
|
try { |
|
|
|
echo "HERE"; |
|
|
|
echo PHP_EOL; |
|
|
|
$otherMessage->getChannel()->getConnection()->close(); |
|
|
|
} catch (Throwable) { |
|
|
|
echo "WHOOPS"; |
|
|
|
echo PHP_EOL; |
|
|
|
} |
|
|
|
echo $body = $message->getMessageBody(); |
|
|
|
echo \PHP_EOL; |
|
|
|
try { |
|
|
|
return match ($body) { |
|
|
|
\strcmp($body, "finish") === 0 => $otherMessage->getChannel()->close(), |
|
|
|
\strcmp($body, "requeue") === 0 => $message->nack(), |
|
|
|
default => $body, |
|
|
|
}; |
|
|
|
$message->ack(); |
|
|
|
} catch (Throwable) { |
|
|
|
$message->nack(); |
|
|
|
} |
|
|
|
$message->ack(); |
|
|
|
}; |
|
|
|
|
|
|
|
$consume = [ |
|
|
|