在SNS主题或Lambda函数上设置“死信队列”有什么区别?
我想知道,因为如果您在SNS订阅上设置了DLQ,那么当Lambda(订阅者)发生故障时,该订阅消息将故障转移到DLQ,对吗?那么在那种情况下在这两个地方设置DLQ会产生相同的效果吗?
我已经在SNS主题订阅上设置了DLQ,但它并没有像Lambda屏幕设置上的DLQ那样“自动地”出现,所以我认为可能会有一些不同吗?
SNS死信队列参考:https : //docs.aws.amazon.com/sns/latest/dg/sns-dead-letter-queues.html
通常,当Amazon SNS由于客户端或服务器端错误而无法访问预订的终端节点时,消息传递会失败。
Lambda死信队列参考:https : //aws.amazon.com/about-aws/whats-new/2016/12/aws-lambda-supports-dead-letter-queues/
在标准重试策略(失败后再进行两次重试)用尽之后,AWS Lambda将调用Lambda函数的事件对象写入此[DLQ]端点。
Lambda:
SNS订阅:
The SNS DLQ is specific for SNS, the benefit here is that it also accounts for client errors such as the Lambda service being down. This will ensure if the Lambda service is down the messages can be replayed to it later, whereas if the DLQ is attached to the Lambda this would only account for a replay if the service is running.
However as I mentioned the SNS DLQ is only for notifications that are from SNS, whereas Lambda can support the DLQ from any incoming events. This means if you have multiple SNS topics, or an SNS topic and some SQS queues you only need to apply it to the Lambda itself.
两种服务都将SQS用于其DLQ,因此两者的摄取/检索将是相同的。如果您在两个服务上都具有DLQ,则可以,您可能会得到事件/通知的2个副本,但是,按照理论上Lambda端点承认SNS将其视为已发送,您将不太可能同时获得这两个副本如果失败,则Lambdas有责任添加到DLQ。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句