Class EventSourceMappingProps
Properties for declaring a new event source mapping.
Inheritance
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.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;
using Amazon.CDK.AWS.Lambda;
IEventSourceDlq eventSourceDlq;
var filters;
Function function_;
SourceAccessConfigurationType sourceAccessConfigurationType;
var eventSourceMappingProps = new EventSourceMappingProps {
Target = function_,
// the properties below are optional
BatchSize = 123,
BisectBatchOnError = false,
Enabled = false,
EventSourceArn = "eventSourceArn",
Filters = new [] { new Dictionary<string, object> {
{ "filtersKey", filters }
} },
KafkaBootstrapServers = new [] { "kafkaBootstrapServers" },
KafkaConsumerGroupId = "kafkaConsumerGroupId",
KafkaTopic = "kafkaTopic",
MaxBatchingWindow = Duration.Minutes(30),
MaxConcurrency = 123,
MaxRecordAge = Duration.Minutes(30),
OnFailure = eventSourceDlq,
ParallelizationFactor = 123,
ReportBatchItemFailures = false,
RetryAttempts = 123,
SourceAccessConfigurations = new [] { new SourceAccessConfiguration {
Type = sourceAccessConfigurationType,
Uri = "uri"
} },
StartingPosition = StartingPosition.TRIM_HORIZON,
StartingPositionTimestamp = 123,
SupportS3OnFailureDestination = false,
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. |
Filters | Add filter criteria to 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. |
KafkaConsumerGroupId | The identifier for the Kafka consumer group to join. |
KafkaTopic | The name of the Kafka topic. |
MaxBatchingWindow | The maximum amount of time to gather records before invoking the function. |
MaxConcurrency | The maximum concurrency setting limits the number of concurrent instances of the function that an Amazon SQS event source can invoke. |
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. |
StartingPositionTimestamp | The time from which to start reading, in Unix time seconds. |
SupportS3OnFailureDestination | Check if support S3 onfailure destination(ODF). |
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
Filters
Add filter criteria to Event Source.
public IDictionary<string, object>[] Filters { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>[]
Remarks
Default: - none
See: https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html
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
KafkaConsumerGroupId
The identifier for the Kafka consumer group to join.
public string KafkaConsumerGroupId { get; set; }
Property Value
System.String
Remarks
The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. The value must have a lenght between 1 and 200 and full the pattern '[a-zA-Z0-9-/:_+=.@-]'. For more information, see Customizable consumer group ID.
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)
MaxConcurrency
The maximum concurrency setting limits the number of concurrent instances of the function that an Amazon SQS event source can invoke.
public Nullable<double> MaxConcurrency { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default: - No specific limit.
See: https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-max-concurrency
Valid Range: Minimum value of 2. Maximum value of 1000.
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: - no starting position
StartingPositionTimestamp
The time from which to start reading, in Unix time seconds.
public Nullable<double> StartingPositionTimestamp { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Default: - no timestamp
SupportS3OnFailureDestination
Check if support S3 onfailure destination(ODF).
public Nullable<bool> SupportS3OnFailureDestination { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Currently only MSK and self managed kafka event support S3 ODF
Default: false
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