Implement worker with RabbitMQ Consumer

137 views Asked by At

What are the consequences of doing this:

public function execute(AMQPMessage $message)
{
    while (true) {
        // Do some heavy work here (Example: retrieve the last 50 items from the database and update their states, etc)

        sleep(2); // Sleep for 2 seconds
    }

    return true; // Acknowledge (Never executed)
}
  1. One unacknowledged message (Bad)
  2. Max execution time of PHP script (But, it works perfectly and is never ending even though phpinfo shows 60 seconds)
  3. Any more issues

Thanks

0

There are 0 answers