def rmq_callback(ch, method, properties, body): print "rmq_callback" image = body print 'processing image ', image tag = image.split(':')[-1] operation = 'compare' if tag == "golden": operation = 'store' process_image(image, operation) if __name__ == "__main__": global CUR_DIR CUR_DIR = os.getcwd() proc_thread1 = FileProcessor('Procthread1') proc_thread2 = FileProcessor('Procthread2') index_thread1 = IndexOrLookup('Idxthread1') index_thread2 = IndexOrLookup('Idxthread2') elasticDB = ElasticDatabase(EsCfg) # TODO: add queuename and host to config msg_queue = MessageQueue('localhost', 'dockerqueue', elasticDB) try: msg_queue.start_consuming(rmq_callback) except KeyboardInterrupt: msg_queue.close() print "Done"
##################################################################### # File: processor.py # Author: Jeremy Mwenda <*****@*****.**> # Desc: This file processes messages (sdhashes) from rabbitMQ. # ####### import os import sys sys.path.append(os.getcwd() + "/../") from scripts.elasticdatabase import ElasticDatabase from scripts.messagequeue import MessageQueue from scripts.esCfg import EsCfg if __name__ == "__main__": elasticDB = ElasticDatabase(EsCfg) # TODO: add queuename and host to config msg_queue = MessageQueue('localhost', 'dockerqueue', elasticDB) msg_queue.start_consuming()