问题
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