Have an issue with AMQP sockets and enqueue-php implementation. For regular, fast working scripts, everything is fine, but if we have a long running process, the system can not acknowledge it, because of a dropped socket. Tried to play with the heartbeats, but the result is not sufficient.
Basically: If I put the heartbeat at default value: 60 (currently it is 15-30), ~90s script is fine, but if the script become even longer, it drops the connection, again.
Need a better solution, due to the fact it is possible to have 24h+ running scripts (which are not possible to be separated or paralleled)
Can not find a working solution, how to leave socket open or reconnect it after execution of a long-running script.
On another thread I've read to ack the message in the beginning of the execution, but again this is not a cool solution and cannot have trust in the system, that a message is processed. Also, we have an implemented retry strategy, which means all long running processes are re-executed, because of the exception at the end of the execution.
We are using the latest versions of php enqueue library with ext-amqp.
"require": {
"enqueue/psr-queue": "^0.5",
"enqueue/enqueue": "^0.8",
"enqueue/amqp-ext": "^0.8",
"enqueue/amqp-tools": "^0.8",
},
The output is:
2018-11-16T06:07:53+02:00 ERR (3): Consuming interrupted by exception
======================================================================
The application has thrown an exception!
======================================================================
AMQPException
Library error: a socket error occurred
#0 /var/www/vendor/enqueue/amqp-ext/AmqpConsumer.php(161): AMQPQueue->ack(2)