Hi,<br><br>A couple of people recently asked about support for persistent connections, after a bit of hacking around I've uploaded an update which has basic persistent connection support: <a href="https://github.com/BraveSirRobin/amqphp" target="_blank">https://github.com/BraveSirRobin/amqphp</a> (check the 0.9.1 tag)<br>
<br><br>The implementation turned out to be fairly straightforward, I only had to add the STREAM_CLIENT_PERSIST flag to the existing stream_socket_client() call, so the changes weren't too invasive. I've created a new "Connection" object called PConnection, and set up a simple framework to persist amqp connection parameters between web requests. The amqp connection setup process is only run the first time the PConnection is opened, so both the Amqp "session" and TCP connection remain after the web request and are re-used by subsequent requests to that process. My plan is to add support for persisting Channels as well, possibly by having API calls use channel.flow to inform the broker during the web request wakeup / sleep routines.<br>
<br>I'd be interested to hear what the RabbitMQ people think about the likely behavior of PHP "persistent connections", which may include:<br><br> * If the web server is restarted, all open client connections are dropped without going through the amqp shutdown
sequence, so you get lots of "closed abruptly" errors in the log.<br> * If a web server has no web requests to process then the persistent client can't respond to any messages the broker sends; the client will "go quiet".<br>
<br>In case you don't know what PHP persistent connections are, they're basically a socket re-use method for web servers, the idea is that the socket remains open between web requests in order to avoid TCP setup / teardown overheads on busy sites.<br>
<br>If you'd like to test this then check out the demo-multi-producer.php script, I've run this inside a PHP-FPM / Nginx setup and it seems to work fine.<br><br>Thanks,<br>--Robin<br>