I\'m working on an application whose workflow is managed by passing messages in SQS, using boto.
My SQS queue is growing gradually, and I have no way to check how many e
Something like the code below should do the trick. Sorry it's in C#, but it shouldn't be hard to convert to python. The dictionary is used to weed out the duplicates.
public Dictionary GetAllMessages(int pollSeconds)
{
var msgs = new Dictionary();
var end = DateTime.Now.AddSeconds(pollSeconds);
while (DateTime.Now <= end)
{
var request = new ReceiveMessageRequest(Url);
request.MaxNumberOfMessages = 10;
var response = GetClient().ReceiveMessage(request);
foreach (var msg in response.Messages)
{
if (!msgs.ContainsKey(msg.MessageId))
{
msgs.Add(msg.MessageId, msg);
}
}
}
return msgs;
}