php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64737 Killing a PHP script using consume() clears the queue
Submitted: 2013-04-29 23:57 UTC Modified: 2013-04-30 22:23 UTC
From: brandon at brandonsavage dot net Assigned:
Status: Closed Package: amqp (PECL)
PHP Version: 5.5.0beta4 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: brandon at brandonsavage dot net
New email:
PHP Version: OS:

 

 [2013-04-29 23:57 UTC] brandon at brandonsavage dot net
Description:
------------
I'm using PHP 5.4beta4 and RabbitMQ 2.8.4. I've noticed that if I use a script that has a consume() method, and doesn't explicitly ack, and then kill off the script, it clears the queue.

Test script:
---------------
<?php

// Create a connection
$cnn = new AMQPConnection();
$cnn->connect();

// Create a channel
$ch = new AMQPChannel($cnn);

// Declare a new exchange
$ex = new AMQPExchange($ch);
$ex->setName('new_topic_exchange');
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->setFlags(AMQP_DURABLE | AMQP_AUTODELETE);
$ex->declare();

// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1');
$q->declare();

// Bind it on the exchange to routing.key
$q->bind('new_topic_exchange', 'routing.key');

// Publish a message to the exchange with a routing key
$ex->publish('message', 'routing.key');

// Read from the queue
$q->consume('var_dump');

Expected result:
----------------
I expect that since I'm not ack-ing the result, the results shouldn't be purged from the queue.

Actual result:
--------------
ALL messages are actually purged from the queue.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-30 22:23 UTC] brandon at brandonsavage dot net
This isn't a bug, it's an implementation error.
 [2013-04-30 22:23 UTC] brandon at brandonsavage dot net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC