Doc #62482 [Com]: Documentation invalid
| From: | bkw at codingforce dot com | Date: | Wed, 14 Nov 2012 01:07:58 +0000 |
| Subject: | Doc #62482 [Com]: Documentation invalid | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9112@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62482&edit=1
ID: 62482
Comment by: bkw at codingforce dot com
Reported by: cg-php at charlesgentry dot com
Summary: Documentation invalid
Status: Open
Type: Documentation Problem
Package: amqp
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
we're trying to update the documentation, most of the recent problem reports stem
from it being completely out of date.
I'm currently appying for a php.net account for that reason exclusively.
Previous Comments:
------------------------------------------------------------------------
[2012-07-20 09:11:21] aharvey@php.net
I don't know if there's a lot of knowledge of amqp among the usual doc contributors.
Pieter, can you have a look if the example in the report is better for that method, please?
------------------------------------------------------------------------
[2012-07-04 15:19:08] cg-php at charlesgentry dot com
Description:
------------
---
From manual page: http://www.php.net/amqpqueue.consume#refsect1-amqpqueue.consume-examples
---
<?php
/* Create a connection using all default credentials: */
$connection = new AMQPConnection();
$connection->connect();
$channel = new AMQPChannel($connection);
/* Create an exchange. This is optional but you must bind the queue
* to a valid name or get an error
*/
$ex = new AMQPExchange( $channel );
/* Give it a name */
$ex->setName( 'myExchange' );
/* Set it as a direct (or point-to-point) type */
$ex->setType( AMQP_EX_TYPE_DIRECT );
/* Tell it to delete when empty */
$ex->setFlags( AMQP_AUTODELETE );
/* Create the exchange */
$ex->declare();
/* create a queue object */
$queue = new AMQPQueue($channel);
/* Start the queue up */
$queue->declare( );
/* Attach the queue to an exchange */
$queue->bind( 'myExchange' , 'routing_key' );
$i = 0;
function processMessage($envelope, $queue) {
global $i;
echo "Message $i: " . $envelope->getBody() . "\n";
$i++;
if ($i > 10) {
// Bail after 10 messages
return false;
}
}
// Consume messages on queue
$queue->consume("processMessage");
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62482&edit=1