|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65243 AMQPQueue->cancel not works w/o consumer tag, but you can't get consumer tag.
Submitted: 2013-07-11 10:40 UTC Modified: 2021-06-10 15:36 UTC
From: metamorfozis at metamorfozis dot hu Assigned: cmb (profile)
Status: Closed Package: amqp (PECL)
PHP Version: Irrelevant OS: ubuntu 12.10
Private report: No CVE-ID: None
 [2013-07-11 10:40 UTC] metamorfozis at metamorfozis dot hu
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 

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 

Test script:

[connection setup]

$channel=new AMQPChannel($conn);
$q=new AMQPQueue($channel);


function processMessage($envelope,$queue) {
    global $i,$argv;
    print "Something arrived... (".$i.")\n";
    if ($i == 2) {

        if ($argv[1] != '') {
            print "Cancelling myself with the received consumer tag...\n";
        } else {
            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)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-10 15:36 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-10 15:36 UTC]
The amqp bug tracker is now on Github[1].  If this is still an
issue, please report there.

[1] <>
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Jan 28 15:03:49 2023 UTC