Lambda多次处理同一SNS事件? [英] Lambda processing same SNS event multiple times?

查看:112
本文介绍了Lambda多次处理同一SNS事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个配置为处理来自单个主题的SNS事件的AWS Lambda函数.函数运行时,它可能会发出一些其他通知,并在发生某些错误时调用context.succeed或context.fail. 问题是同一SNS事件似乎多次调用Lambda.查看我看到的CloudWatch日志

I have an AWS Lambda function configured to process SNS events from a single topic. When the function runs it will potentially send out some other notifications and call context.succeed, or context.fail if some error occurs. The problem is the same SNS event seems to be invoking the Lambda multiple times. Looking at the CloudWatch logs I see

START RequestId: cd7afdf8-2816-11e6-bca2-6f2e3027c5e1 Version: $LATEST

最终会结束

END RequestId: cd7afdf8-2816-11e6-bca2-6f2e3027c5e1 REPORT RequestId: cd7afdf8-2816-11e6-bca2-6f2e3027c5e1 ...

END RequestId: cd7afdf8-2816-11e6-bca2-6f2e3027c5e1 REPORT RequestId: cd7afdf8-2816-11e6-bca2-6f2e3027c5e1 ...

在同一日志中紧随其后的是一个完全相同的RequestID的开始

Immediately followed in the same log by a start for the exact same RequestID

START RequestId: cd7afdf8-2816-11e6-bca2-6f2e3027c5e1 Version: $LATEST

在发送此SNS事件的主题中查看CloudWatch,它似乎只像我期望的那样仅发布和交付一个,因此这似乎是Lambda方面的问题.有人知道某个事件可能多次触发我的lambda吗?

Looking into CloudWatch at the topic sending this SNS Event it seems to only be Publishing and Delivering only one even as I had expected, so it seems to be a Lambda-side problem. Does anyone know of any reason an event might be triggering my lambda multiple times like this?

我注意到lambda收到故障时似乎正在发生这种情况.我没有在lambda上看到任何重试配置,并且不希望它在默认情况下表现为这种方式.

I've noticed that this seems to be happening when the lambda receives a failure. I don't see any sort of retry configuration on the lambda and wouldn't expect it to be behaving this way by default.

推荐答案

来自Amazon lambda常见问题解答页面 https://aws.amazon.com/lambda/faqs/

From Amazon lambda FAQs page https://aws.amazon.com/lambda/faqs/

问:如果我的Lambda函数在处理事件期间失败了怎么办?

Q: What happens if my Lambda function fails during processing an event?

失败时,同步调用的Lambda函数将以异常响应.至少 3次会重试异步调用的Lambda函数,此后该事件可能会被拒绝.重试来自Amazon Kinesis流和Amazon DynamoDB流的事件,直到Lambda函数成功或数据到期为止. Kinesis和DynamoDB流将数据保留24小时.

On failure, Lambda functions being invoked synchronously will respond with an exception. Lambda functions being invoked asynchronously are retried at least 3 times, after which the event may be rejected. Events from Amazon Kinesis streams and Amazon DynamoDB streams are retried until the Lambda function succeeds or the data expires. Kinesis and DynamoDB Streams retain data for 24 hours.

这篇关于Lambda多次处理同一SNS事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆