CC-5709 / CC-5705 : Airtime Analyzer
* Finished the skeleton of the airtime_analyzer service. * Basic round-robin, reliable AMQP messaging works. * Using multiprocess arch so the daemon survives analyzer crashes and avoids failures propagating to other nodes. * Basic metadata extractor using Mutagen is done. * HTTP requests to the File API to are next to come...
This commit is contained in:
parent
b6dd2e3152
commit
a6a64a2b9e
15 changed files with 411 additions and 0 deletions
47
python_apps/airtime_analyzer/tools/message_sender.php
Normal file
47
python_apps/airtime_analyzer/tools/message_sender.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?
|
||||
require_once('php-amqplib/amqp.inc');
|
||||
|
||||
//use PhpAmqpLibConnectionAMQPConnection;
|
||||
//use PhpAmqpLibMessageAMQPMessage;
|
||||
|
||||
define('HOST', '127.0.0.1');
|
||||
define('PORT', '5672');
|
||||
define('USER', 'airtime');
|
||||
define('PASS', 'QEFKX5GMKT4YNMOAL9R8');
|
||||
define('VHOST', '/airtime');//'/airtime');
|
||||
|
||||
$exchange = "airtime-uploads";
|
||||
$exchangeType = "topic";
|
||||
$queue = "airtime-uploads";
|
||||
$routingKey = ""; //"airtime.analyzer.tasks";
|
||||
|
||||
if ($argc <= 1)
|
||||
{
|
||||
echo("Usage: " . $argv[0] . " message\n");
|
||||
exit();
|
||||
}
|
||||
|
||||
$message = $argv[1];
|
||||
|
||||
$connection = new AMQPConnection(HOST, PORT, USER, PASS, VHOST);
|
||||
if (!isset($connection))
|
||||
{
|
||||
echo "Failed to connect to the RabbitMQ server.";
|
||||
return;
|
||||
}
|
||||
|
||||
$channel = $connection->channel();
|
||||
|
||||
// declare/create the queue
|
||||
$channel->queue_declare($queue, false, true, false, false);
|
||||
|
||||
// declare/create the exchange as a topic exchange.
|
||||
$channel->exchange_declare($exchange, $exchangeType, false, false, false);
|
||||
|
||||
$msg = new AMQPMessage($message, array("content_type" => "text/plain"));
|
||||
|
||||
$channel->basic_publish($msg, $exchange, $routingKey);
|
||||
print "Sent $message ($routingKey)\n";
|
||||
$channel->close();
|
||||
$connection->close();
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue