import os from services.loft import Loft from helpers import aws_helper print("Starting Solver Service (v0.3.1)...") # listen to the solver queue while True: msg = aws_helper.receive_message(os.environ['SOLVER_SQS_INGEST_QUEUE']) # get the item from the queue for message in msg.get("Messages", []): # for now the solver service only supports Loft types # this is here to allow us to create an extensible way to # gather/manage/process data based on the particular needs service = Loft(message) service.process() # delete message once process is complete response = aws_helper.delete_message(os.environ['SOLVER_SQS_INGEST_QUEUE'], message['ReceiptHandle']) # probably convert to logging, but maybe keep this to some extent print("MESSAGE PROCESSED: ", message['MessageId'])