sqs settings modified

This commit is contained in:
Ubuntu 2024-05-01 04:58:44 +00:00
parent 37654cb4ec
commit 6b8db9f2e6
1 changed files with 23 additions and 18 deletions

View File

@ -175,26 +175,31 @@ class Command(BaseCommand):
print("Started Executin this from conversion")
queue = sqs.get_queue_by_name(QueueName="mnfqueue")
# try:
messages = queue.receive_messages(
MessageAttributeNames=["All"],
MaxNumberOfMessages=5,
WaitTimeSeconds=20,
)
for msg in messages:
try:
print("Received message: %s: %s", msg.message_id, msg.body)
print(type(msg.body))
body_dict = json.loads(msg.body)
if body_dict['service_type'] == "conversion":
while True:
run_conversion(msg)
messages = queue.receive_messages(
MessageAttributeNames=["All"],
MaxNumberOfMessages=5,
WaitTimeSeconds=10,
)
if len(messages) > 0:
elif body_dict['service_type'] == "audit":
for msg in messages:
try:
print("Received message: %s: %s", msg.message_id, msg.body)
print(type(msg.body))
body_dict = json.loads(msg.body)
if body_dict['service_type'] == "conversion":
run_audit(msg)
run_conversion(msg)
except Exception as error:
print("error execution from queue: %s", error)
elif body_dict['service_type'] == "audit":
run_audit(msg)
except Exception as error:
print("error execution from queue: %s", error)
else:
break
print("Completed All Execution")