AWS SNS 传送到 AWS Lambda 的可靠性

Reliability of AWS SNS delivery to AWS Lambda

来自 AWS SNS FAQ page(可靠性部分)我可以看到 SNS 保证至少一次将消息传递到 SQS,但不清楚在向 Lambda 发送通知时是否同样适用。

那么问题是,当消息发送到 AWS Lambda 时,SNS 是否提供至少一次消息传递?

同样FAQ page指出

When a message is published to a topic, Amazon SNS will attempt to deliver notifications to all subscribers registered for that topic. Due to potential Internet issues or Email delivery restrictions, sometimes the notification may not successfully reach an HTTP or Email end-point. In the case of HTTP, an SNS Delivery Policy can be used to control the retry pattern (linear, geometric, exponential backoff), maximum and minimum retry delays, and other parameters. If it is critical that all published messages be successfully processed, developers should have notifications delivered to an SQS queue (in addition to notifications over other transports).

这适用于所有非 SQS 订阅者

我认为您的问题是:订阅 SNS 主题的 Lambda 函数是否会针对任何消息至少调用一次或仅调用一次?

如果是,答案是:至少一次。 FAQs 的以下部分有助于回答这个问题,强调 我的:

Q: How many times will a subscriber receive each message?

Although most of the time each message will be delivered to your application exactly once, the distributed nature of Amazon SNS and transient network conditions could result in occasional, duplicate messages at the subscriber end. Developers should design their applications such that processing a message more than once does not create any errors or inconsistencies.

问。如果订阅端点不可用,Amazon SNS 消息会怎样?

Lambda: If Lambda is not available, SNS will retry 2 times at 1 seconds apart, then 10 times exponentially backing off from 1 seconds to 20 minutes and finally 38 times every 20 minutes for a total 50 attempts over more than 13 hours before the message is discarded from SNS.

https://aws.amazon.com/sns/faqs/