How to realize that consumers automatically trigger to read messages by php rabbitmq

1, According to the official rabbitmq documentation, we set up a test to create a queue and send messages to receive messages, but they are all executed in the form of php server.php and php client.php. If deployed to a server, how to implement client.php automatic consumption of messages in this queue always keeps in touch with the server.
some of the information on the Internet is to write a sell script. And the while loop to deal with it. I don"t know what other way to deal with it.

Php
Mar.07,2021

regular execution of php client.php



:basicConsume;basicGet<br>:

$queue->consume($callback);    // callbackwhile(true)

pull:

for(...) {
    $queue->get();    
}
Menu