Class EventSourceMappingProps
Properties for declaring a new event source mapping.
Inheritance
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.AWS.Lambda.dll
Syntax (csharp)
public class EventSourceMappingProps : Object, IEventSourceMappingProps, IEventSourceMappingOptions
Syntax (vb)
Public Class EventSourceMappingProps
Inherits Object
Implements IEventSourceMappingProps, IEventSourceMappingOptions
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lambda;
using Amazon.CDK;
IEventSourceDlq eventSourceDlq;
Function function_;
SourceAccessConfigurationType sourceAccessConfigurationType;
var eventSourceMappingProps = new EventSourceMappingProps {
Target = function_,
// the properties below are optional
BatchSize = 123,
BisectBatchOnError = false,
Enabled = false,
EventSourceArn = "eventSourceArn",
KafkaBootstrapServers = new [] { "kafkaBootstrapServers" },
KafkaTopic = "kafkaTopic",
MaxBatchingWindow = Duration.Minutes(30),
MaxRecordAge = Duration.Minutes(30),
OnFailure = eventSourceDlq,
ParallelizationFactor = 123,
ReportBatchItemFailures = false,
RetryAttempts = 123,
SourceAccessConfigurations = new [] { new SourceAccessConfiguration {
Type = sourceAccessConfigurationType,
Uri = "uri"
} },
StartingPosition = StartingPosition.TRIM_HORIZON,
TumblingWindow = Duration.Minutes(30)
};
Synopsis
Constructors
EventSourceMappingProps() |
Properties
BatchSize | The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. |
BisectBatchOnError | If the function returns an error, split the batch in two and retry. |
Enabled | Set to false to disable the event source upon creation. |
EventSourceArn | The Amazon Resource Name (ARN) of the event source. |
KafkaBootstrapServers | A list of host and port pairs that are the addresses of the Kafka brokers in a self managed "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap itself. |
KafkaTopic | The name of the Kafka topic. |
MaxBatchingWindow | The maximum amount of time to gather records before invoking the function. |
MaxRecordAge | The maximum age of a record that Lambda sends to a function for processing. |
OnFailure | An Amazon SQS queue or Amazon SNS topic destination for discarded records. |
ParallelizationFactor | The number of batches to process from each shard concurrently. |
ReportBatchItemFailures | Allow functions to return partially successful responses for a batch of records. |
RetryAttempts | The maximum number of times to retry when the function returns an error. |
SourceAccessConfigurations | Specific settings like the authentication protocol or the VPC components to secure access to your event source. |
StartingPosition | The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading. |
Target | The target AWS Lambda function. |
TumblingWindow | The size of the tumbling windows to group records sent to DynamoDB or Kinesis. |
Constructors
EventSourceMappingProps()
public EventSourceMappingProps()
Properties
BatchSize
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.
public Nullable<double> BatchSize { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Your function receives an event with all the retrieved records.
Valid Range: Minimum value of 1. Maximum value of 10000.
Default: - Amazon Kinesis, Amazon DynamoDB, and Amazon MSK is 100 records. The default for Amazon SQS is 10 messages. For standard SQS queues, the maximum is 10,000. For FIFO SQS queues, the maximum is 10.
BisectBatchOnError
If the function returns an error, split the batch in two and retry.
public Nullable<bool> BisectBatchOnError { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
Enabled
Set to false to disable the event source upon creation.
public Nullable<bool> Enabled { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: true
EventSourceArn
The Amazon Resource Name (ARN) of the event source.
public string EventSourceArn { get; set; }
Property Value
System.String
Remarks
Any record added to this stream can invoke the Lambda function.
Default: - not set if using a self managed Kafka cluster, throws an error otherwise
KafkaBootstrapServers
A list of host and port pairs that are the addresses of the Kafka brokers in a self managed "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap itself.
public string[] KafkaBootstrapServers { get; set; }
Property Value
System.String[]
Remarks
They are in the format abc.example.com:9096
.
Default: - none
KafkaTopic
The name of the Kafka topic.
public string KafkaTopic { get; set; }
Property Value
System.String
Remarks
Default: - no topic
MaxBatchingWindow
The maximum amount of time to gather records before invoking the function.
public Duration MaxBatchingWindow { get; set; }
Property Value
Remarks
Maximum of Duration.minutes(5)
Default: Duration.seconds(0)
MaxRecordAge
The maximum age of a record that Lambda sends to a function for processing.
public Duration MaxRecordAge { get; set; }
Property Value
Remarks
Valid Range:
Default: - infinite or until the record expires.
OnFailure
An Amazon SQS queue or Amazon SNS topic destination for discarded records.
public IEventSourceDlq OnFailure { get; set; }
Property Value
Remarks
Default: discarded records are ignored
ParallelizationFactor
The number of batches to process from each shard concurrently.
public Nullable<double> ParallelizationFactor { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Valid Range:
Default: 1
ReportBatchItemFailures
Allow functions to return partially successful responses for a batch of records.
public Nullable<bool> ReportBatchItemFailures { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
RetryAttempts
The maximum number of times to retry when the function returns an error.
public Nullable<double> RetryAttempts { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Set to undefined
if you want lambda to keep retrying infinitely or until
the record expires.
Valid Range:
Default: - infinite or until the record expires.
SourceAccessConfigurations
Specific settings like the authentication protocol or the VPC components to secure access to your event source.
public ISourceAccessConfiguration[] SourceAccessConfigurations { get; set; }
Property Value
Remarks
StartingPosition
The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading.
public Nullable<StartingPosition> StartingPosition { get; set; }
Property Value
System.Nullable<StartingPosition>
Remarks
Default: - Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK Streams sources.
Target
TumblingWindow
The size of the tumbling windows to group records sent to DynamoDB or Kinesis.
public Duration TumblingWindow { get; set; }
Property Value
Remarks
Default: - None
See: https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-windows
Valid Range: 0 - 15 minutes