Doc #61589 [Com]: amqp example not worked
| From: | bkw at codingforce dot com | Date: | Wed, 14 Nov 2012 01:54:58 +0000 |
| Subject: | Doc #61589 [Com]: amqp example not worked | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9117@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61589&edit=1
ID: 61589
Comment by: bkw at codingforce dot com
Reported by: gwijaya at gmail dot com
Summary: amqp example not worked
Status: Open
Type: Documentation Problem
Package: amqp
Operating System: Ubuntu 10.04, PHP 5.3.2
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Thanks for reporting this.
Work is underway to update the documentation, but it might take some time, since
there is bureaucracy involved. We'll update this ticket when we had a chance to
update the exmaples.
Previous Comments:
------------------------------------------------------------------------
[2012-04-01 07:00:44] gwijaya at gmail dot com
Description:
------------
http://php.net/manual/en/amqp.examples.php
throw many error when using PECL AMQP 1.0.1. exchange declare, and queue declare should have 0
parameter, so we have to set parameters on the constructor
OS: Ubuntu 5.3.2
PHP: 5.3.2
AMQP: 1.0.1
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->declare('exchange1', AMQP_EX_TYPE_FANOUT);
// Create a new queue
$q = new AMQPQueue($ch);
$q->declare('queue1');
// Bind it on the exchange to routing.key
$ex->bind('queue1', 'routing.key');
// Publish a message to the exchange with a routing key
$ex->publish('message', 'routing.key');
// Read from the queue
$msg = $q->consume();
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61589&edit=1