Can you suggest the best way to forward messages from stdin to rabbitmq. Unfortunately, in the example below, stdin is blocked for a significant amount of time.
<?php
declare(strict_types=1);
use Bunny\Client;
require_once __DIR__ . '/vendor/autoload.php';
$channel = (new Client())->connect()->channel();
while (($record = fgetcsv(STDIN, 4096, ',')) !== false) {
$channel->publish(json_encode($record), [], '', $config['queue']['name']);
}
Logically, I need to use an asynchronous client but did not find a similar example.
Can you suggest the best way to forward messages from stdin to rabbitmq. Unfortunately, in the example below, stdin is blocked for a significant amount of time.
Logically, I need to use an asynchronous client but did not find a similar example.