Amazon EventBridge/step函数/lambda-可以在不引入同步处理的情况下实现势力吗?
我们有一个工作流(步骤函数),该工作流程是通过EventBridge规则触发的,在该工作流程中是在第三方供应商系统中创建记录的lambda。假设第三方供应商API无法执行记录的唯一性,我们想知道是否有可能在不引入同步处理的情况下实现IDEMETINCE(供应商中无重复的记录创建),例如FIFO queue/limim Limit limit limim limim limim limim limiment lambda一致性。
由于EventBridge不仅一次交付一次,而是保证了至少一次交货,因此我们遇到了一个问题,由于同时处理的重复事件(5ms 〜Apply),因此在供应商系统中创建了重复的记录。
我想知道是否有可能在不引入FIFO队列或将lambda并发限制为1的情况下进行防止,如果不是,我们将与之相关,并在lambda中添加检查以查看供应商系统中的记录是否已经存在,或者记录是否已经存在我们这边的处理/处理。
我的理解是对记录的唯一性进行控制检查是不够的(例如,同时处理同一记录,检查供应商API/Dynamo/SQL将返回相同的结果)。
我很确定我们有答案/解决方案,但是只检查我是否没有忽略某件事。
We have a Workflow (Step Function) that is triggered via an EventBridge rule and inside that Workflow is a lambda that creates a record in a third party vendor system. Assuming the third party vendor API does not have a way to enforce uniqueness of a record, we are wondering if it's possible to achieve idempotency (no duplicate record creations in vendor) without introducing synchronous processing e.g. a FIFO queue/limit lambda concurrency.
As EventBridge does not gaurantee only once delivery but instead guarantees at least once delivery, we encountered an issue with duplicate records being created in the vendor system due to duplicate events being processed at the same time (5ms~ apart).
I am wondering if it's possible to prevent this without introducing a FIFO queue or limiting lambda concurrency to 1, if not we will proceeed with that and add a check in the lambda to see if the record already exists in vendor system or if the record is processed/processing on our side.
My understanding is a control check on the uniqueness of the record will not suffice while concurrency exists (e.g. 2 lambdas concurrently processing the same record checking the vendor API/Dynamo/SQL will return the same result).
I am pretty sure we have our answer/solution but just checking if I have not overlooked something to do this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Lambda PowerTools提供了一个势力模块,以帮助解决此类情况。
它目前可在 java> java 编程语言。
它处理一些困难的边缘案例,并由DynamoDB支持。
Lambda Powertools provides an idempotency module to help with this type of scenario.
It is currently available in Python and Java programming languages.
It handles some of the difficult edge cases and is backed by DynamoDB.
版本中可用
现在在AWS lambda powertools的打字稿 .powertools.aws.dev/lambda/typescript/latest/utilities/idempotency/
Now available in the typescript version of AWS Lambda Powertools
https://docs.powertools.aws.dev/lambda/typescript/latest/utilities/idempotency/