$sender->
send(new Envelope(new DummyMessage('Hello'
)));
$amqpReadTimeout = 30;
$dsn =
getenv('MESSENGER_AMQP_DSN'
).'?read_timeout='.
$amqpReadTimeout;
$process =
new PhpProcess(file_get_contents(__DIR__.'/../Fixtures/long_receiver.php'
), null,
[ 'COMPONENT_ROOT' => __DIR__.'/../../',
'DSN' =>
$dsn,
]);
$process->
start();
$this->
waitForOutput($process,
$expectedOutput = "Receiving messages...\n"
);
$signalTime =
microtime(true
);
$timedOutTime =
time() + 10;
// wait for worker started and registered the signal handler
usleep(100 * 1000
); // 100ms
// immediately after the process has started "booted", kill it
$process->
signal(15
);
while ($process->
isRunning() &&
time() <
$timedOutTime) {