I tried boto api
and seems that no api can get message number already in flight? Does anyone give me a hint how to get this number?
To find the messages in flight or any of the other attributes of an SQS queue in boto, you need to do this:
import boto.sqs
c = boto.sqs.connect_to_region('us-east-1')
queue = c.lookup('myqueue')
attr = queue.get_attributes()
This will 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 the ApproximateNumberOfMessagesNotVisible
is equivalent to the in-flight statistic reported by the console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With