How to use boto to get aws sqs message already in flight

I have tried boto api

and it seems that the api cannot get the message number already in flight? Can anyone tell me how to get this number?

+3


source to share


1 answer


To find in-flight messages or any other attributes of the SQS queue in boto, you need to do the following:

import boto.sqs
c = boto.sqs.connect_to_region('us-east-1')
queue = c.lookup('myqueue')
attr = queue.get_attributes()

      

It will be a python dictionary that looks like this:



{u'ApproximateNumberOfMessages': u'0',
 u'ApproximateNumberOfMessagesDelayed': u'0',
 u'ApproximateNumberOfMessagesNotVisible': u'0',
 u'CreatedTimestamp': u'1412270007',
 u'DelaySeconds': u'0',
 u'LastModifiedTimestamp': u'1412270007',
 u'MaximumMessageSize': u'262144',
 u'MessageRetentionPeriod': u'345600',
 u'QueueArn': u'arn:aws:sqs:us-east-1:723405645490:16ac1da3-564c-43aa-8dcb-4db41ece50ea',
 u'ReceiveMessageWaitTimeSeconds': u'0',
 u'VisibilityTimeout': u'30'}

      

I believe this is ApproximateNumberOfMessagesNotVisible

equivalent to in-flight statistics reported by the console.

+6


source







All Articles