Doc #63342 [Com]: Undefined constant AMQP_NOACK
| From: | bkw at codingforce dot com | Date: | Wed, 14 Nov 2012 00:41:37 +0000 |
| Subject: | Doc #63342 [Com]: Undefined constant AMQP_NOACK | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9111@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63342&edit=1
ID: 63342
Comment by: bkw at codingforce dot com
Reported by: andre dot torgal at gmail dot com
Summary: Undefined constant AMQP_NOACK
Status: Verified
Type: Documentation Problem
Package: amqp
Operating System: Linux Ubuntu 2.6.32 32bit
PHP Version: 5.3.18
Assigned To: pdezwart
Block user comment: N
Private report: N
New Comment:
Thanks for reporting. The documentation is out of date unfortunately. Work is
underway to remedy this.
Previous Comments:
------------------------------------------------------------------------
[2012-10-23 22:56:50] philip@php.net
It appears AMQP_NOACK was removed and replaced with AMQP_AUTOACK as of 1.0.0 of
this extension, and that the AMQPQueue::consume() documentation still refers to
the old constant.
Proper fix: add a changelog entry that mentions this change (where? it's not
specific to a method, but one location is fine), and replace AMQP_NOACK with
AMQP_AUTOACK in the documentation. Steal the flags parameter description from
another method.
------------------------------------------------------------------------
[2012-10-23 21:14:04] andre dot torgal at gmail dot com
Description:
------------
Trying to use AMQP_NOACK on AMQPQueue::consume($callback, [int $flags]) complains
about undefined constants.
pecl/amqp is already installed and is the same as the released version 1.0.7
Using protocol version => 0-9-1
Meanwhile I found out - by using get_declared_constants() - that the current name
for this constant should be AMQP_AUTOACK, which actually makes more sense and
matches the amqp ini var: amqp.auto_ack => 0 => 0
Test script:
---------------
$exchangeName = 'DirectExchange';
$queueName = 'Process';
$routingKey = 'This';
// connect
$connection = new AMQPConnection();
$channel = new AMQPChannel($connection);
// configure and declare an exchange
$exchange = new \AMQPExchange($channel);
$exchange->setType(AMQP_EX_TYPE_DIRECT);
$exchange->setName($exchangeName);
$exchange->setFlags(AMQP_DURABLE);
$exchange->declare();
// configure and declare a queue
$queue = new \AMQPQueue($channel);
$queue->setName($queueName);
$queue->setFlags(AMQP_DURABLE);
$queue->declare();
$queue->consume($callback, AMQP_AUTOACK)
Expected result:
----------------
Consume is executed and registered callback is triggered
Actual result:
--------------
PHP Notice: Use of undefined constant AMQP_NOACK - assumed 'AMQP_NOACK'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63342&edit=1