createEventSourceMapping (original) (raw)
Creates a mapping between an event source and an Lambda function. Lambda reads items from the event source and invokes the function.
For details about how to configure different event sources, see the following topics.
- Amazon DynamoDB Streams
- Amazon Kinesis
- Amazon SQS
- Amazon MQ and RabbitMQ
- Amazon MSK
- Apache Kafka
- Amazon DocumentDB
The following error handling options are available only for DynamoDB and Kinesis event sources:
BisectBatchOnFunctionError
– If the function returns an error, split the batch in two and retry.MaximumRecordAgeInSeconds
– Discard records older than the specified age. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expiresMaximumRetryAttempts
– Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records are retried until the record expires.ParallelizationFactor
– Process multiple batches from each shard concurrently.
For stream sources (DynamoDB, Kinesis, Amazon MSK, and self-managed Apache Kafka), the following option is also available:
DestinationConfig
– Send discarded records to an Amazon SQS queue, Amazon SNS topic, or Amazon S3 bucket.
For information about which configuration parameters apply to each event source, see the following topics.
- Amazon DynamoDB Streams
- Amazon Kinesis
- Amazon SQS
- Amazon MQ and RabbitMQ
- Amazon MSK
- Apache Kafka
- Amazon DocumentDB
Samples
fun main() {
//sampleStart
// The following example creates a mapping between an SQS queue and the my function Lambda function.
val resp = lambdaClient.createEventSourceMapping {
eventSourceArn = "arn:aws:sqs:us-west-2:123456789012:my-queue"
functionName = "my-function"
batchSize = 5
}
//sampleEnd
}