Answer the question
In order to leave comments, you need to log in
PHP persistent connection?
Hello.
Is it possible to make a persistent connection to the queuing service? At high load there are problems with the connection.
Stack: nginx, php-fpm, rabbitmq
Answer the question
In order to leave comments, you need to log in
How do you work with queues in general? Do you think with a permanent connection there will be no problems with falling off?
1. Use a sish client for RabbitMQ, not a PHP library.
2. Use the subscription on the queue, and do not hammer in the cycle for checking for updates, there you simply subscribe to updates and pass the handler function to it, which will be executed at lightning speed when messages are received. An example can be found here
3. You can check the connection like this (if you have the amqp library)
if ($conn->isConnected()) {
echo "Connected to the broker \o/";
}
else {
echo "Cannot connect to the broker";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question