CC-2750: Ability to query health status for pypo,
liquidsoap, media monitor, and recorder -fixed rabbitmq not delivering messages
This commit is contained in:
parent
d942e476c6
commit
2c2bb86698
|
@ -7,6 +7,7 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
|
|||
if (RabbitMq::$doPush) {
|
||||
$md = array('schedule' => Schedule::GetScheduledPlaylists());
|
||||
RabbitMq::SendMessageToPypo("update_schedule", $md);
|
||||
RabbitMq::SendMessageToShowRecorder("update_schedule");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,6 @@ class RabbitMq
|
|||
$channel->basic_publish($msg, $EXCHANGE);
|
||||
$channel->close();
|
||||
$conn->close();
|
||||
|
||||
self::SendMessageToShowRecorder("update_schedule");
|
||||
}
|
||||
|
||||
public static function SendMessageToMediaMonitor($event_type, $md)
|
||||
|
|
|
@ -4,6 +4,9 @@ class Application_Model_Systemstatus
|
|||
{
|
||||
|
||||
public static function GetPypoStatus(){
|
||||
|
||||
RabbitMq::SendMessageToPypo("get_status", array());
|
||||
|
||||
return array(
|
||||
"process_id"=>500,
|
||||
"uptime_seconds"=>3600
|
||||
|
|
|
@ -20,6 +20,7 @@ import filecmp
|
|||
# For RabbitMQ
|
||||
from kombu.connection import BrokerConnection
|
||||
from kombu.messaging import Exchange, Queue, Consumer, Producer
|
||||
from kombu.exceptions import MessageStateError
|
||||
|
||||
from api_clients import api_client
|
||||
|
||||
|
@ -72,26 +73,33 @@ class PypoFetch(Thread):
|
|||
Hopefully there is a better way to do this.
|
||||
"""
|
||||
def handle_message(self, body, message):
|
||||
logger = logging.getLogger('fetch')
|
||||
logger.info("Received event from RabbitMQ: " + message.body)
|
||||
try:
|
||||
logger = logging.getLogger('fetch')
|
||||
logger.info("Received event from RabbitMQ: " + message.body)
|
||||
|
||||
m = json.loads(message.body)
|
||||
command = m['event_type']
|
||||
logger.info("Handling command: " + command)
|
||||
|
||||
m = json.loads(message.body)
|
||||
command = m['event_type']
|
||||
logger.info("Handling command: " + command)
|
||||
|
||||
if command == 'update_schedule':
|
||||
self.schedule_data = m['schedule']
|
||||
self.process_schedule(self.schedule_data, "scheduler", False)
|
||||
elif command == 'update_stream_setting':
|
||||
logger.info("Updating stream setting...")
|
||||
self.regenerateLiquidsoapConf(m['setting'])
|
||||
elif command == 'cancel_current_show':
|
||||
logger.info("Cancel current show command received...")
|
||||
self.stop_current_show()
|
||||
elif command == 'get_status':
|
||||
self.get_status()
|
||||
# ACK the message to take it off the queue
|
||||
message.ack()
|
||||
if command == 'update_schedule':
|
||||
self.schedule_data = m['schedule']
|
||||
self.process_schedule(self.schedule_data, "scheduler", False)
|
||||
elif command == 'update_stream_setting':
|
||||
logger.info("Updating stream setting...")
|
||||
self.regenerateLiquidsoapConf(m['setting'])
|
||||
elif command == 'cancel_current_show':
|
||||
logger.info("Cancel current show command received...")
|
||||
self.stop_current_show()
|
||||
elif command == 'get_status':
|
||||
self.get_status()
|
||||
except Exception, e:
|
||||
logger.error("Exception in handling RabbitMQ message: %s", e)
|
||||
finally:
|
||||
# ACK the message to take it off the queue
|
||||
try:
|
||||
message.ack()
|
||||
except MessageStateError, m:
|
||||
logger.error("Message ACK error: %s", m);
|
||||
|
||||
def get_status(self):
|
||||
logger = logging.getLogger('fetch')
|
||||
|
|
Loading…
Reference in New Issue