A demonstration on how to write a persistent PHP consumer for RabbitMQ RPC queues. This tutorial assumes you already are familiar with connecting to RabbitMQ. The demonstration focuses on making the PHP consumer persistent through mitigation of PHP's inherent memory leaks through a managed parent-child fork() model allowing your consumer applications to run indefinitely.
I was experiencing connection timeouts on my RabbitMQ daemons when the system had accumulated 90-minutes of inactivity. Even though I had enabled the native (to RabbitMQ) keep-alive feature, node.js connection requests were still crashing the system.
This article identifies why the heart-beat feature does not work in PHP and provides a work-around solution to the issue.
How I used pcntl_fork() to fork a child process from a long-running (daemon) PHP script and used shared-memory to pass data from the child to the parent, in a rabbitMQ message broker program.