AWS SQS如何知道消息处理失败?

huangapple go评论62阅读模式
英文:

AWS SQS how does SQS know that processing of a message failed?

问题

I'm reading aws documents on deadletter queue and re-drive policy, and the document mentioned "The redrive policy specifies the source queue, the dead-letter queue, and the conditions under which Amazon SQS moves messages from the former to the latter if the consumer of the source queue fails to process a message a specified number of times".

However, even the document mentioned "message process failed" several times, I do not understand how sqs detects a message processing failure (and thus triggers re-drive or move to the dead letter queue.)

From what I understand, consumer applications call receiveMessage to retrieve the message from SQS, then process the message. The processing function is not passed in to receiveMessage as a lambda. So how does SQS know that message processing has failed?

英文:

I'm reading aws documents on deadletter queue and re-drive policy, and the document mentioned "The redrive policy specifies the source queue, the dead-letter queue, and the conditions under which Amazon SQS moves messages from the former to the latter if the consumer of the source queue fails to process a message a specified number of times".

However, even the document mentioned "message process failed" several times, I do not understand how sqs detects a message processing failure (and thus triggers re-drive or move to the dead letter queue.)

From what I understand, consumer applications call receiveMessage to retrieve the message from SQS, then process the message. The processing function is not passed in to receiveMessage as a lambda. So how does SQS know that message processing has failed?

答案1

得分: 0

当客户端(例如 Lambda 函数)从队列中收到消息时,它有有限的时间来调用 DeleteMessage。每条消息还具有可见性超时。如果客户端在可见性超时内未删除消息,SQS "假定"处理失败。

根据您设置的允许的失败尝试次数,这些消息可以被转发到 SQS。

英文:

When a client (e.g. a lambda function) gets a message from the queue, it has limited time to call DeleteMessage. Each msg has also visibility timeout. If the msg is not deleted by the client within the visibility timeout, SQS "assumes" that the processing failed.

Such messages can be then forwarded to SQS depending on how many failed attempts you setup to tollerate.

huangapple
  • 本文由 发表于 2023年2月6日 13:19:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/75357575.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定