CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.
This commit is contained in:
parent
514777e8d2
commit
b11cbd8159
4546 changed files with 138 additions and 51 deletions
54
airtime_mvc/library/php-amqplib/demo/amqp_consumer.php
Normal file
54
airtime_mvc/library/php-amqplib/demo/amqp_consumer.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
/**
|
||||
* Repeatedly receive messages from queue until it receives a message with
|
||||
* 'quit' as the body.
|
||||
*
|
||||
* @author Sean Murphy<sean@iamseanmurphy.com>
|
||||
*/
|
||||
|
||||
require_once('../amqp.inc');
|
||||
|
||||
$HOST = 'localhost';
|
||||
$PORT = 5672;
|
||||
$USER = 'guest';
|
||||
$PASS = 'guest';
|
||||
$VHOST = '/';
|
||||
$EXCHANGE = 'router';
|
||||
$QUEUE = 'msgs';
|
||||
$CONSUMER_TAG = 'consumer';
|
||||
|
||||
$conn = new AMQPConnection($HOST, $PORT, $USER, $PASS);
|
||||
$ch = $conn->channel();
|
||||
$ch->access_request($VHOST, false, false, true, true);
|
||||
|
||||
$ch->queue_declare($QUEUE);
|
||||
$ch->exchange_declare($EXCHANGE, 'direct', false, false, false);
|
||||
$ch->queue_bind($QUEUE, $EXCHANGE);
|
||||
|
||||
function process_message($msg) {
|
||||
global $ch, $CONSUMER_TAG;
|
||||
|
||||
echo "\n--------\n";
|
||||
echo $msg->body;
|
||||
echo "\n--------\n";
|
||||
|
||||
$ch->basic_ack($msg->delivery_info['delivery_tag']);
|
||||
|
||||
// Cancel callback
|
||||
if ($msg->body === 'quit') {
|
||||
$ch->basic_cancel($CONSUMER_TAG);
|
||||
}
|
||||
}
|
||||
|
||||
$ch->basic_consume($QUEUE, $CONSUMER_TAG, false, false, false, false, 'process_message');
|
||||
|
||||
// Loop as long as the channel has callbacks registered
|
||||
echo "Waiting for messages...\n";
|
||||
while(count($ch->callbacks)) {
|
||||
$ch->wait();
|
||||
}
|
||||
|
||||
$ch->close();
|
||||
$conn->close();
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue