#!/usr/bin/python import sys import ast def main(cmdArgs): # Simple script showing how a python process is run based on the output from amqpfind for a RabbitMQ messages. # An external process could be started based on criteria form the RabbitMQ message. # This changes the input from amqpfind to a dictionary eventInfo = ast.literal_eval(cmdArgs[2]) # Create a meaningful string for the satellite satellite = eventInfo['satellite_family'] + '-' + eventInfo['satellite_ID'][1:3] # If end is in the status and it is for a band end message, print messages based on what is in the RabbitMQ payload if 'end' in eventInfo['status']: if eventInfo['band'] == 10 : print ('Band 10 for ' + satellite + ' ' + eventInfo['coverage'] + ' sector has been received') print ('File Location:') print (eventInfo['path']) print ('Begin processing') print (' ') else: return else: return return if __name__ == '__main__': main(sys.argv)