|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-06-10 15:36 UTC] cmb@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: cmb
[2021-06-10 15:36 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 18:00:01 2025 UTC |
Description: ------------ The problem is two fold: * AMQPQueue->cancel($consumer_tag) works, but normally with pecl AMQP you can't get the consumer tag * AMQPQueue->cancel() not works The first problem is obvious. It would be great to have a getConsumerTag() method somewhere. I have debugged the second problem, and the problem is that it sends an empty consumer tag, so because of that the cancel not happens. It also receives a Cancel-ok, as accordign to the reference the server should ignore nonexistent consumertags. Test script: --------------- <?php [connection setup] $channel=new AMQPChannel($conn); $q=new AMQPQueue($channel); $q->setName('cancel_test'); $q->setFlags(AMQP_DURABLE); $q->declare(); $q->consume('processMessage'); function processMessage($envelope,$queue) { global $i,$argv; $i++; print "Something arrived... (".$i.")\n"; $queue->ack($envelope->getDeliveryTag()); if ($i == 2) { if ($argv[1] != '') { $queue->cancel($envelope->getBody()); print "Cancelling myself with the received consumer tag...\n"; } else { $queue->cancel($envelope->getBody()); print "Cancelling myself...\n"; } } if ($i == 10) { return false; } return true; } ?> Expected result: ---------------- No messages after cancelling. See actual results. Actual result: -------------- $ php -f amqpqueue_consume_cancel.php Something arrived... (1) Something arrived... (2) Cancelling myself... Something arrived... (3) ^C