Patch amqp_example.patch for amqp Bug #61589
Patch version 2012-04-01 07:01 UTC
Return to Bug #61589 |
Download this patch
Patch Revisions:
Developer: gwijaya@gmail.com
diff --git a/testpub.php b/testpub2.php
index 105c4eb..0c7a41e 100644
--- a/testpub.php
+++ b/testpub2.php
@@ -6,13 +6,19 @@ $cnn->connect();
$ch = new AMQPChannel($cnn);
// Declare a new exchange
$ex = new AMQPExchange($ch);
-$ex->declare('exchange1', AMQP_EX_TYPE_FANOUT);
+$ex->setName('exchange1');
+$ex->setType(AMQP_EX_TYPE_FANOUT);
+$ex->declare();
// Create a new queue
$q = new AMQPQueue($ch);
-$q->declare('queue1');
+$q->setName('queue1');
+$q->declare();
// Bind it on the exchange to routing.key
-$ex->bind('queue1', 'routing.key');
+$q->bind('exchange1', 'routing.key');
// Publish a message to the exchange with a routing key
$ex->publish('message', 'routing.key');
-// Read from the queue
-$msg = $q->consume();
+$response = $q->get();
+if(is_object($response)) {
+ echo $response->getBody();
+}
+$cnn->disconnect();
|