CC-2084: Integrate RabbitMQ for immediate schedule updates and commands
Implemented RabbitMQ on the pypo side. Schedule updates are now almost instantaneous and we are only polling the server once per hour if we aren't updated in that time. Canceling a show happens right away.
This commit is contained in:
parent
7f7800aa2b
commit
78b33b9e23
5 changed files with 218 additions and 109 deletions
|
@ -10,23 +10,23 @@ class RabbitMq
|
|||
* in the future.
|
||||
*/
|
||||
public static function PushSchedule() {
|
||||
// global $CC_CONFIG;
|
||||
// $conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
||||
// $CC_CONFIG["rabbitmq"]["port"],
|
||||
// $CC_CONFIG["rabbitmq"]["user"],
|
||||
// $CC_CONFIG["rabbitmq"]["password"]);
|
||||
// $channel = $conn->channel();
|
||||
// $channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
|
||||
//
|
||||
// $EXCHANGE = 'airtime-schedule';
|
||||
// $channel->exchange_declare($EXCHANGE, 'direct', false, false, false);
|
||||
//
|
||||
// $data = json_encode(Schedule::ExportRangeAsJson());
|
||||
// $msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
|
||||
//
|
||||
// $channel->basic_publish($msg, $EXCHANGE);
|
||||
// $channel->close();
|
||||
// $conn->close();
|
||||
global $CC_CONFIG;
|
||||
$conn = new AMQPConnection($CC_CONFIG["rabbitmq"]["host"],
|
||||
$CC_CONFIG["rabbitmq"]["port"],
|
||||
$CC_CONFIG["rabbitmq"]["user"],
|
||||
$CC_CONFIG["rabbitmq"]["password"]);
|
||||
$channel = $conn->channel();
|
||||
$channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true);
|
||||
|
||||
$EXCHANGE = 'airtime-schedule';
|
||||
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
|
||||
|
||||
$data = json_encode(Schedule::ExportRangeAsJson());
|
||||
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
|
||||
|
||||
$channel->basic_publish($msg, $EXCHANGE);
|
||||
$channel->close();
|
||||
$conn->close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue