[rabbitmq-discuss] Apache/PHP_mod and keeping connection alive
jonathan.bouzekri at gmail.com
Sat Apr 5 16:40:00 BST 2014
I bought the Rabbit In Action book. The authors said that you should not
open a connection to Rabbit every single time you want to send a message.
It seems logic when you know the channel mecanism however in a HTTP context
with a server web, I don't see how you can do it. Especially in an
Apache/PHP mod context. You can't share a connection between requests in
PHP because each request has its own process and scope and don't share
anything (or I don't know of any method to do it).
So suppose you must send a message through Rabbit each time a user make a
GET request to your server, you will open a connection, create an exchange
(maybe a queue too), send a message, close the connection. It will be time
consumming and maybe overload rabbit. Is there another solution ? I am
thinking about queueing my message in a simple SQL table (because I already
open the connection to the server at each request) and process each line
with a batch which will send the message to Rabbit but It seems like
building another queue mecanism from scratch ....
Thanks in advance for your suggestion.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rabbitmq-discuss