If a AWS Lambda function has event sources from multiple Kinesis streams, will the batch of incoming records be from a single Kinesis stream or a mix?

浪尽此生 提交于 2019-12-19 03:20:22

问题


The title might be a bit confusing. I'll try my best to make it clearer.

Suppose I have a AWS Lambda function that has two different Kinesis streams A and B as input event sources.

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) {
        ...
    }
}

回答1:


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"
}

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.



来源:https://stackoverflow.com/questions/32410674/if-a-aws-lambda-function-has-event-sources-from-multiple-kinesis-streams-will-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!