Replace deprecated php-amqplib API

As of php-amqplib version 2.12.0 (see PR:
https://github.com/php-amqplib/php-amqplib/pull/799) we should use
method `ack()` on the message directly.

Asked by @michaelklishin in https://github.com/rabbitmq/rabbitmq-website/pull/1113
This commit is contained in:
Patrick Allaert 2020-12-18 17:34:32 +01:00
parent e8ad99adc4
commit 1851d779f7
3 changed files with 3 additions and 5 deletions

View File

@ -1,5 +1,5 @@
{
"require": {
"php-amqplib/php-amqplib": ">=v2.8.2-rc3"
"php-amqplib/php-amqplib": ">=v2.12.1"
}
}

View File

@ -35,9 +35,7 @@ $callback = function ($req) {
'',
$req->get('reply_to')
);
$req->delivery_info['channel']->basic_ack(
$req->delivery_info['delivery_tag']
);
$req->ack();
};
$channel->basic_qos(null, 1, null);

View File

@ -14,7 +14,7 @@ $callback = function ($msg) {
echo ' [x] Received ', $msg->body, "\n";
sleep(substr_count($msg->body, '.'));
echo " [x] Done\n";
$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
$msg->ack();
};
$channel->basic_qos(null, 1, null);