Skip to Content
Hybrid Cloud for Developers
book

Hybrid Cloud for Developers

by Manoj Hirway
April 2018
Intermediate to advanced content levelIntermediate to advanced
280 pages
8h 37m
English
Packt Publishing
Content preview from Hybrid Cloud for Developers

Receiving a message from the queue

Messages from the queue can be received from the queue by invoking the receive_message() function of the SQS client object and passing the queue URL, the name of the message attributes, the list of attributes that need to be returned along with each message, the maximum number of messages to return, the visibility timeout, and wait time. 

The following code receives a message from the queue:

response = sqs_object.receive_message(    QueueUrl=queue_url,    AttributeNames=[        'SentTimestamp'    ],    MaxNumberOfMessages=1,    MessageAttributeNames=[        'All'    ],    VisibilityTimeout=0,    WaitTimeSeconds=0)print responsemessage = response['Messages']print message

The message is in the form of a Python dictionary and looks as follows. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hybrid Cloud for Architects

Hybrid Cloud for Architects

Alok Shrivastwa
OpenStack: Building a Cloud Environment

OpenStack: Building a Cloud Environment

Alok Shrivastwa, Sunil Sarat, Kevin Jackson, Cody Bunch, Egle Sigler, Tony Campbell

Publisher Resources

ISBN: 9781788830874Supplemental Content