问题描述
标题可能有点混乱.我会尽力使它更清楚.
The title might be a bit confusing. I'll try my best to make it clearer.
假设我有一个AWS Lambda函数,它具有两个不同的Kinesis流A和B作为输入事件源.
Suppose I have a AWS Lambda function that has two different Kinesis streams A and B as input event sources.
那么,对于以下情况,由于KinesisEvent实例包含一批记录,该批处理将包含来自单个流的记录,还是本质上它包含来自流A和B的记录?
So, for the below, since a KinesisEvent instance contains a batch of records, will the batch contain records from a single stream, or essentially it contain records from both streams A and B?
public class ProcessKinesisEvents {
public void recordHandler(KinesisEvent event, Context context) {
...
}
}
推荐答案
AWS Kinesis 之间的每个映射流和 AWS Lambda 函数是通过调用 CreateEventSourceMapping ,由 EventSourceArn 和 FunctionName ,您还可以为其指定专用的批量大小:
Each mapping between an AWS Kinesis stream and an AWS Lambda function is a dedicated entity resulting from a call to CreateEventSourceMapping and comprised of the EventSourceArn and the FunctionName, for which you also specify a dedicated Batch Size accordingly:
POST /2015-03-31/event-source-mappings/ HTTP/1.1
Content-type: application/json
{
"BatchSize": number,
"Enabled": boolean,
"EventSourceArn": "string",
"FunctionName": "string",
"StartingPosition": "string"
}
因此,您将收到的批次将限制为构成响应的单个事件源.映射,以及每个其他事件源都将相应地对Lambda函数进行单独调用,因此所有内容均已正确隔离.
Consequently, the batches you will receive are constrained to the single event source that constitutes the resp. mapping, and each other event source will yield a separate invocation of your Lambda function accordingly, so everything is properly isolated.
这篇关于如果AWS Lambda函数具有来自多个Kinesis流的事件源,那么传入记录的批处理将来自单个Kinesis流还是混合源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!