import os import sys from services.loft_service import LoftService from helpers import aws_helper from sqs_listener import SqsListener from sqs_listener.daemon import Daemon 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 = LoftService(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'])