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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Sun May 16 10:01:24 2021 UTC