php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #62482 Documentation invalid
Submitted: 2012-07-04 15:19 UTC Modified: 2014-12-27 22:18 UTC
From: cg-php at charlesgentry dot com Assigned: sobak (profile)
Status: Closed Package: amqp (PECL)
PHP Version: Irrelevant OS:
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: cg-php at charlesgentry dot com
New email:
PHP Version: OS:

 

 [2012-07-04 15:19 UTC] 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");



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-20 09:11 UTC] aharvey@php.net
-Package: Documentation problem +Package: amqp
 [2012-07-20 09:11 UTC] 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-11-14 01:07 UTC] bkw at codingforce dot com
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.
 [2014-12-27 22:18 UTC] sobak@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: sobak
 [2014-12-27 22:18 UTC] sobak@php.net
AMQP documentation is no longer a part of php.net manual.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC