基于Kinesis记录分区密钥调用Lambda [英] Invoke Lambda based on Kinesis records Partition Key

查看:120
本文介绍了基于Kinesis记录分区密钥调用Lambda的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的运动流中流入的数据类型不同.每个记录都有一个不同的分区键.仅当将具有某些分区键的记录添加到流中时,才需要调用lambda函数.有没有一种方法可以指定仅在遇到分区键"a"时才触发lambda,而不是调用lambda然后检查分区键?

解决方案

您可以使用SNS主题,在其中仅推送具有特定分区键的记录,然后将另一个lambda函数连接到处理记录的那个主题./p>

另一个选择是异步重新调用您的lambda函数.好处是您不需要其他组件(即没有SNS主题).

这基本上是如何工作的,如果分区键为"a",则签入函数;如果分区键为"a",则使用记录和指示应处理记录的特定参数异步重新调用该函数.

您可以在此处了解更多有关如何完成此操作的信息: https://engineering.dubsmash.com/实施实时分析,使用aws-kinesis-lambda-1ea56f10e473

I have different Types of data flowing in through my kinesis streams. Each of the record has a different partition key. I need to invoke a lambda function only if a record with certain partition key in added to the stream. Is there a way to specify that the lambda would be triggered only if a partition key "a" is encountered rather than invoking a lambda and then checking the partition key?

解决方案

You can either use an SNS topic where you push only records that have a certain partition key and then connect another lambda function to that topic that processes the records.

Another option would be to asynchronously re-invoke your lambda function. The benefit is that you don't need another component (i.e., no SNS topic).

How this would work is basically that you check in your function if the partition key is "a" and if it is, re-invoke the function asynchronously with the record and a specific parameter that indicates that the record should be processed.

You can read more about how this can be done here: https://engineering.dubsmash.com/implementing-real-time-analytics-using-aws-kinesis-lambda-1ea56f10e473

这篇关于基于Kinesis记录分区密钥调用Lambda的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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