简体   繁体   English

AWS SNS > SQS > Lambda 触发器。 这是异步调用还是同步调用?

[英]AWS SNS > SQS > Lambda Trigger. Is this async or sync invocation?

I am using Client > SNS > SQS > Lambda Trigger我正在使用客户端 > SNS > SQS > Lambda 触发器

As per my understanding, SNS > Lamda will be an asynchronous invocation据我了解, SNS > Lamda将是一个异步调用

However, SNS > SQS > Lambda supposed to be synchronous.但是, SNS > SQS > Lambda应该是同步的。

  1. Is my understanding correct?我的理解正确吗?

I have configured DLQ on the SQS source but doesn't store failed message into DLQ.我已经在 SQS 源上配置了 DLQ,但没有将失败的消息存储到 DLQ 中。 Also saw 2x retried attempt on Lambda cloudwatch.在 Lambda cloudwatch 上也看到了 2 次重试。

  1. If SNS > SQS > Lambda is synchronous, I think this should not happen am I right?如果SNS > SQS > Lambda是同步的,我认为这不应该发生,对吗?

@jellycsc already answered your question in the comment section, but i would like to expand it. @jellycsc 已经在评论部分回答了你的问题,但我想扩展它。 Shortly it is poll based which uses synchronous invocation for it.不久,它是基于轮询的,它使用synchronous调用。

There are three type of invocation models for AWS Lambda AWS Lambda 共有三种类型的调用模型

  1. Synchronous同步
    • Elastic Load Balancing弹性负载平衡
    • Alexa亚历克斯
    • Cognito认知
    • API Gateway (there is an async version of it too) API 网关(也有异步版本)
  2. Asynchronous异步
    • S3 S3
    • SNS社交网络
    • Cloudwatch/Eventbridge events Cloudwatch/Eventbridge 事件
  3. Poll-based基于投票的
    • Kinesis运动
    • SQS SQS
    • DynamoDB streams DynamoDB 流

According to the this blogpost根据这篇

AWS will manage the poller on your behalf and perform Synchronous invokes of your function with this type of integration. AWS 将代表您管理轮询器,并通过这种类型的集成对您的 function 执行Synchronous调用。 The retry behavior for this model is based on data expiration in the data source.此 model 的重试行为基于数据源中的数据到期。 For example, Kinesis Data streams store records for 24 hours by default (up to 168 hours).例如,Kinesis Data 流默认存储 24 小时(最长 168 小时)的记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM