Question:
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?
1 2 3 4 5 6 |
public class ProcessKinesisEvents { public void recordHandler(KinesisEvent event, Context context) { ... } } |
Answer:
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:
1 2 3 4 5 6 7 8 9 10 11 |
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.