,

AWS SQS – receive_message

When using the “receive_message” Python Boto function to pull message(s) from a SQS queue, you will always get a response back when the command completes.  However, how do you determine if the response you got back actually contains a valid message?

Quick trick:

response = sqs.receive_message
if 'Messages' in response:
    print("Message on the queue to process")
else:
    print("No messages on the queue to process")

Thats about it!!

python

Hello, Welcome to DevOpsUnleashed!

A blog dedicated to sharing information about DevOps. Here, you’ll find examples, tips, and tutorials on DevOps.

Feel free to share your experiences in the comments!

Blog Categories