我正在使用 python boto 2.8,但无法删除消息。这是我的测试代码:
conn = boto.sqs.connect_to_region("us-east-1",
aws_access_key_id=AWS_ACCESS_KEY,
aws_secret_access_key=AWS_SECRET_KEY)
q = conn.get_queue("sqs_bounces")
q.set_message_class(RawMessage) //need this to be able to get message as json
results = q.get_messages(num_messages=10,visibility_timeout=30,wait_time_seconds=10)
for rs in results:
str = rs.get_body()
print str
result = json.loads(str)
rs = json.loads(result["Message"])
print rs["notificationType"]
#get the email and save it as bounced
// Do saving.....
#Delete message
//How do i delete the current message?
这里有人可以指导我如何删除它吗?有时我收到 1 条消息,有时是 3 条。而且我不想在每次拉取时都保存相同的退回电子邮件,这就是为什么我需要在保存它们后将其删除。
谢谢