Export to GitHub

php-amqplib - issue #5

Messages are not being ACKed correctly (in demo script)


Posted on Aug 20, 2009 by Helpful Ox

What steps will reproduce the problem? 1. Send a durable message using amqp_publisher.php script 2. Receive message using amqp_consumer.php script 3. list queues i operating exchange: rabbitmqctl list_queues -p /test (or restart the consumer - the same message will be received again)

What is the expected output? What do you see instead? Listing queues ... test_queue 1 done.

instead of: Listing queues ... test_queue 0 done.

What version of the product are you using? On what operating system? latest / linux

Please provide any additional information below.

I'm not sure where it should be fixed. Messages are not being ACKed correctly because $msg->delivery_tag does not return a delivery_tag. The delivery_tag can be fetched from $msg->delivery_info['delivery_tag'] or $msg->delivery_tag should also return a proper delivery_tag A quick fix solution will be: --- amqp_consumer.php.orig 2009-08-20 11:08:43.000000000 +0100 +++ amqp_consumer.php 2009-08-20 10:40:38.000000000 +0100

@@ -38,7 +38,7 @@ echo $msg->delivery_info['delivery_tag']; echo "\n--------\n";

  • $ch->basic_ack($msg->delivery_tag);
  • $ch->basic_ack($msg->delivery_info['delivery_tag']);

    // Cancel callback if ($msg->body === 'quit') {

Comment #1

Posted on Aug 20, 2009 by Helpful Ox

sorry, previous diff was incorrect

--- amqp_consumer.php.orig 2009-08-20 12:52:39.000000000 +0100 +++ amqp_consumer.php 2009-08-20 12:53:48.000000000 +0100 @@ -33,7 +33,7 @@ echo $msg->body; echo "\n--------\n";

  • $ch->basic_ack($msg->delivery_tag);
  • $ch->basic_ack($msg->delivery_info['delivery_tag']);

    // Cancel callback if ($msg->body === 'quit') {

Comment #2

Posted on Aug 21, 2009 by Happy Lion

patch commited. thanks

Status: Fixed

Labels:
Type-Defect Priority-Medium