SNS到Lambda的SNS到SQS到Lambda的SNS [英] SNS to Lambda vs SNS to SQS to Lambda

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

问题描述

如果有人可以帮助解释,我想了解我的工作流程中是否需要SQS.在我的应用程序中,执行操作后,它将信息提交到SNS主题,该主题调用LAMBDA进行一些处理.这样就可以很好地工作.

I'm trying to understand whether I need SQS in my workflow if someone can help explain. In my app, when an action is taken, it submits info to SNS topic which invokes LAMBDA to do some processing. This is working great as it is.

当我在线研究时,似乎人们也在该堆栈中使用SQS,SNS会将信息放在SQS上,然后SQS随后将调用LAMBDA.

When I do research online, it seems that people are using SQS in this stack as well where SNS would put info on SQS and then SQS would then invoke LAMBDA.

我想我想了解的是对此的SQS需求.通过直接从SNS调用LAMBDA可以增加什么价值,或者换句话说,我将失去什么?

I guess what I'm trying to understand is the need for SQS in this. What value doe that add or in other words, what am I losing by invoking my LAMBDA directly from SNS?

推荐答案

在SNS和Lambda之间具有SQS的唯一优势是重新处理. 假设Lambda由于某种原因(例如超时或缺少内存占用)而无法处理某些事件,您可以增加超时(最多5分钟)或内存(最大1.5GB)并重新开始轮询,然后可以重新处理较旧的事件.

The only advantage of having a SQS in between SNS and Lambda is Reprocessing. Assume that the Lambda fails to process certain event for some reason (e.g. timeout or lack of memory footprint), you can increase the timeout (to max 5 minutes) or memory (to max of 1.5GB) and restart your polling and you can reprocess the older events.

对于Lambda的SNS,这是不可能的,其中,如果Lambda失败,则事件将丢失.而且,即使您配置了DLQ,您仍然必须为单独阅读和处理消息做好准备

This would not be possible in case of SNS to Lambda, wherein if Lambda fails the event is lost. And even if you configure DLQ you would still have to make provisions for reading that separately and processing the message

因此,如果您的事件很重要而又不想错过,那就去SNS-SQS-Lambda

So if your events are critical and you don't want to miss out on them, then go for SNS - SQS - Lambda

说过,SQS不能像SNS一样触发lambda.您将不得不定期轮询SQS

Having said that SQS cannot trigger lambda like SNS. You will have to poll the SQS at frequent intervals

AWS宣布SQS在2018年6月28日触发Lambda支持.因此,不再需要频繁轮询队列. SQS的新项目可能会触发Lambda

AWS announced SQS triggering Lambda support on 28 JUN 2018. So no need anymore for polling the queue at frequent intervals. New items to SQS can trigger Lambda

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

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