[英]SQS Messages Not Deleting
I have a small set of messages in an SQS queue, that are not deleted even though a deletion request sent to the AWS endpoint returns with a 200 response.我在 SQS 队列中有一小部分消息,即使发送到 AWS 端点的删除请求返回 200 响应,也不会删除这些消息。 The messages are processed by my application fine, and the deletion request is sent fine too.我的应用程序可以很好地处理这些消息,并且也可以很好地发送删除请求。
I'm using the Java AWS SDK 1.3.6.我使用的是 Java AWS SDK 1.3.6。
Has anyone else experienced this problem?有没有其他人遇到过这个问题?
Whoops - the queue was accidentally set to defaultVisibilityTimeout=0
. 糟糕 - 队列被意外设置为defaultVisibilityTimeout=0
。 Changing this to a positive value fixed the problem. 将此值更改为正值可解决问题。
This still raises a few questions though: 这仍然提出了几个问题:
Official documentation (version 1.9.13) 官方文件(版本1.9.13)
IMPORTANT: It is possible you will receive a message even after you have deleted it. 重要提示:即使您删除了该消息,也可能会收到消息。 This might happen on rare occasions if one of the servers storing a copy of the message is unavailable when you request to delete the message. 如果在请求删除邮件时存储邮件副本的其中一个服务器不可用,则极少数情况下可能会发生这种情况。 The copy remains on the server and might be returned to you again on a subsequent receive request. 副本仍保留在服务器上,并可能在后续接收请求中再次返回给您。 You should create your system to be idempotent so that receiving a particular message more than once is not a problem. 您应该将系统创建为幂等的,以便不止一次地接收特定消息不是问题。
If you have pass in your exception there is a good chance you're not actually deleting your sqs message so it is getting stuck "in flight" because there may be an error in your processing.如果您传入了异常,则很有可能您实际上并未删除 sqs 消息,因此它会卡在“飞行中”,因为您的处理过程中可能存在错误。 Wrap your sqs polling in a try except like this and see if you have any exceptions:将您的 sqs 轮询包装起来,除了像这样,看看您是否有任何例外:
import traceback
import sys
try:
pollsqshere()
except Exception:
print(traceback.format_exc())
# or
print(sys.exc_info()[2])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.