I am not an experienced used in the Amazon SQS service. I have to read messages from a queue that I do not own and process them making a small database with some of the information.
Up until now I just had some code that would read all the messages in the queue and process them. The script was running periodically.
However, recently I observed that the amount of messages in the queue has suddenly become very large. When I took a 10000 sample messages I observed that around 6000 where duplicates.
I am puzzled by this sudden change in behavior (up until now I did not observe duplicate messages). The queue never seems to run out.
This is the code I use to read all the messages from the queue.
conn = boto.sqs.connect_to_region(
'myregions',
aws_access_key_id='myacceskey',
aws_secret_access_key='secretAccesKey')
q = boto.sqs.queue.Queue(connection=conn, url='outputQueue')
rs = q.get_messages(10)
all_messages = []
while len(rs) > 0:
all_messages.extend(rs)
print (len(all_messages))
rs = q.get_messages(10)
Can anybody explain why I am getting duplicated messages suddenly? I do not have permissions to see how large the queue is, how can I get all messages in it? Am I doing it right?