@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-05-10T17:05:56.398Z") @Stability(value=Stable) public class CfnEventSourceMapping extends CfnResource implements IInspectable
The AWS::Lambda::EventSourceMapping resource creates a mapping between an event source and an AWS Lambda function. Lambda reads items from the event source and triggers the function.
For details about each event source type, see the following topics. In particular, each of the topics describes the required and optional parameters for the specific event source.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.lambda.*;
CfnEventSourceMapping cfnEventSourceMapping = CfnEventSourceMapping.Builder.create(this, "MyCfnEventSourceMapping")
.functionName("functionName")
// the properties below are optional
.amazonManagedKafkaEventSourceConfig(AmazonManagedKafkaEventSourceConfigProperty.builder()
.consumerGroupId("consumerGroupId")
.build())
.batchSize(123)
.bisectBatchOnFunctionError(false)
.destinationConfig(DestinationConfigProperty.builder()
.onFailure(OnFailureProperty.builder()
.destination("destination")
.build())
.build())
.documentDbEventSourceConfig(DocumentDBEventSourceConfigProperty.builder()
.collectionName("collectionName")
.databaseName("databaseName")
.fullDocument("fullDocument")
.build())
.enabled(false)
.eventSourceArn("eventSourceArn")
.filterCriteria(FilterCriteriaProperty.builder()
.filters(List.of(FilterProperty.builder()
.pattern("pattern")
.build()))
.build())
.functionResponseTypes(List.of("functionResponseTypes"))
.maximumBatchingWindowInSeconds(123)
.maximumRecordAgeInSeconds(123)
.maximumRetryAttempts(123)
.parallelizationFactor(123)
.queues(List.of("queues"))
.scalingConfig(ScalingConfigProperty.builder()
.maximumConcurrency(123)
.build())
.selfManagedEventSource(SelfManagedEventSourceProperty.builder()
.endpoints(EndpointsProperty.builder()
.kafkaBootstrapServers(List.of("kafkaBootstrapServers"))
.build())
.build())
.selfManagedKafkaEventSourceConfig(SelfManagedKafkaEventSourceConfigProperty.builder()
.consumerGroupId("consumerGroupId")
.build())
.sourceAccessConfigurations(List.of(SourceAccessConfigurationProperty.builder()
.type("type")
.uri("uri")
.build()))
.startingPosition("startingPosition")
.startingPositionTimestamp(123)
.topics(List.of("topics"))
.tumblingWindowInSeconds(123)
.build();
| Modifier and Type | Class and Description |
|---|---|
static interface |
CfnEventSourceMapping.AmazonManagedKafkaEventSourceConfigProperty
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.
|
static class |
CfnEventSourceMapping.Builder
A fluent builder for
CfnEventSourceMapping. |
static interface |
CfnEventSourceMapping.DestinationConfigProperty
A configuration object that specifies the destination of an event after Lambda processes it.
|
static interface |
CfnEventSourceMapping.DocumentDBEventSourceConfigProperty
Specific configuration settings for a DocumentDB event source.
|
static interface |
CfnEventSourceMapping.EndpointsProperty
The list of bootstrap servers for your Kafka brokers in the following format: `"KafkaBootstrapServers": ["abc.xyz.com:xxxx","abc2.xyz.com:xxxx"]` .
|
static interface |
CfnEventSourceMapping.FilterCriteriaProperty
An object that contains the filters for an event source.
|
static interface |
CfnEventSourceMapping.FilterProperty
A structure within a `FilterCriteria` object that defines an event filtering pattern.
|
static interface |
CfnEventSourceMapping.OnFailureProperty
A destination for events that failed processing.
|
static interface |
CfnEventSourceMapping.ScalingConfigProperty
(Amazon SQS only) The scaling configuration for the event source.
|
static interface |
CfnEventSourceMapping.SelfManagedEventSourceProperty
The self-managed Apache Kafka cluster for your event source.
|
static interface |
CfnEventSourceMapping.SelfManagedKafkaEventSourceConfigProperty
Specific configuration settings for a self-managed Apache Kafka event source.
|
static interface |
CfnEventSourceMapping.SourceAccessConfigurationProperty
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.
|
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$ProxyIConstruct.Jsii$Default| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnEventSourceMapping(Construct scope,
String id,
CfnEventSourceMappingProps props)
Create a new `AWS::Lambda::EventSourceMapping`.
|
protected |
CfnEventSourceMapping(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnEventSourceMapping(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
Object |
getAmazonManagedKafkaEventSourceConfig()
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.
|
String |
getAttrId()
The event source mapping's ID.
|
Number |
getBatchSize()
The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function.
|
Object |
getBisectBatchOnFunctionError()
(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry.
|
protected Map<String,Object> |
getCfnProperties() |
Object |
getDestinationConfig()
(Kinesis and DynamoDB Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.
|
Object |
getDocumentDbEventSourceConfig()
Specific configuration settings for a DocumentDB event source.
|
Object |
getEnabled()
When true, the event source mapping is active.
|
String |
getEventSourceArn()
The Amazon Resource Name (ARN) of the event source.
|
Object |
getFilterCriteria()
An object that defines the filter criteria that determine whether Lambda should process an event.
|
String |
getFunctionName()
The name of the Lambda function.
|
List<String> |
getFunctionResponseTypes()
(Streams and SQS) A list of current response type enums applied to the event source mapping.
|
Number |
getMaximumBatchingWindowInSeconds()
The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function.
|
Number |
getMaximumRecordAgeInSeconds()
(Kinesis and DynamoDB Streams only) Discard records older than the specified age.
|
Number |
getMaximumRetryAttempts()
(Kinesis and DynamoDB Streams only) Discard records after the specified number of retries.
|
Number |
getParallelizationFactor()
(Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard.
|
List<String> |
getQueues()
(Amazon MQ) The name of the Amazon MQ broker destination queue to consume.
|
Object |
getScalingConfig()
(Amazon SQS only) The scaling configuration for the event source.
|
Object |
getSelfManagedEventSource()
The self-managed Apache Kafka cluster for your event source.
|
Object |
getSelfManagedKafkaEventSourceConfig()
Specific configuration settings for a self-managed Apache Kafka event source.
|
Object |
getSourceAccessConfigurations()
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.
|
String |
getStartingPosition()
The position in a stream from which to start reading.
|
Number |
getStartingPositionTimestamp()
With `StartingPosition` set to `AT_TIMESTAMP` , the time from which to start reading, in Unix time seconds.
|
List<String> |
getTopics()
The name of the Kafka topic.
|
Number |
getTumblingWindowInSeconds()
(Kinesis and DynamoDB Streams only) The duration in seconds of a processing window for DynamoDB and Kinesis Streams event sources.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected Map<String,Object> |
renderProperties(Map<String,Object> props) |
void |
setAmazonManagedKafkaEventSourceConfig(CfnEventSourceMapping.AmazonManagedKafkaEventSourceConfigProperty value)
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.
|
void |
setAmazonManagedKafkaEventSourceConfig(IResolvable value)
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.
|
void |
setBatchSize(Number value)
The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function.
|
void |
setBisectBatchOnFunctionError(Boolean value)
(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry.
|
void |
setBisectBatchOnFunctionError(IResolvable value)
(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry.
|
void |
setDestinationConfig(CfnEventSourceMapping.DestinationConfigProperty value)
(Kinesis and DynamoDB Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.
|
void |
setDestinationConfig(IResolvable value)
(Kinesis and DynamoDB Streams only) An Amazon SQS queue or Amazon SNS topic destination for discarded records.
|
void |
setDocumentDbEventSourceConfig(CfnEventSourceMapping.DocumentDBEventSourceConfigProperty value)
Specific configuration settings for a DocumentDB event source.
|
void |
setDocumentDbEventSourceConfig(IResolvable value)
Specific configuration settings for a DocumentDB event source.
|
void |
setEnabled(Boolean value)
When true, the event source mapping is active.
|
void |
setEnabled(IResolvable value)
When true, the event source mapping is active.
|
void |
setEventSourceArn(String value)
The Amazon Resource Name (ARN) of the event source.
|
void |
setFilterCriteria(CfnEventSourceMapping.FilterCriteriaProperty value)
An object that defines the filter criteria that determine whether Lambda should process an event.
|
void |
setFilterCriteria(IResolvable value)
An object that defines the filter criteria that determine whether Lambda should process an event.
|
void |
setFunctionName(String value)
The name of the Lambda function.
|
void |
setFunctionResponseTypes(List<String> value)
(Streams and SQS) A list of current response type enums applied to the event source mapping.
|
void |
setMaximumBatchingWindowInSeconds(Number value)
The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function.
|
void |
setMaximumRecordAgeInSeconds(Number value)
(Kinesis and DynamoDB Streams only) Discard records older than the specified age.
|
void |
setMaximumRetryAttempts(Number value)
(Kinesis and DynamoDB Streams only) Discard records after the specified number of retries.
|
void |
setParallelizationFactor(Number value)
(Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard.
|
void |
setQueues(List<String> value)
(Amazon MQ) The name of the Amazon MQ broker destination queue to consume.
|
void |
setScalingConfig(CfnEventSourceMapping.ScalingConfigProperty value)
(Amazon SQS only) The scaling configuration for the event source.
|
void |
setScalingConfig(IResolvable value)
(Amazon SQS only) The scaling configuration for the event source.
|
void |
setSelfManagedEventSource(CfnEventSourceMapping.SelfManagedEventSourceProperty value)
The self-managed Apache Kafka cluster for your event source.
|
void |
setSelfManagedEventSource(IResolvable value)
The self-managed Apache Kafka cluster for your event source.
|
void |
setSelfManagedKafkaEventSourceConfig(CfnEventSourceMapping.SelfManagedKafkaEventSourceConfigProperty value)
Specific configuration settings for a self-managed Apache Kafka event source.
|
void |
setSelfManagedKafkaEventSourceConfig(IResolvable value)
Specific configuration settings for a self-managed Apache Kafka event source.
|
void |
setSourceAccessConfigurations(IResolvable value)
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.
|
void |
setSourceAccessConfigurations(List<Object> value)
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.
|
void |
setStartingPosition(String value)
The position in a stream from which to start reading.
|
void |
setStartingPositionTimestamp(Number value)
With `StartingPosition` set to `AT_TIMESTAMP` , the time from which to start reading, in Unix time seconds.
|
void |
setTopics(List<String> value)
The name of the Kafka topic.
|
void |
setTumblingWindowInSeconds(Number value)
(Kinesis and DynamoDB Streams only) The duration in seconds of a processing window for DynamoDB and Kinesis Streams event sources.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdgetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validatejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnEventSourceMapping(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnEventSourceMapping(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnEventSourceMapping(@NotNull
Construct scope,
@NotNull
String id,
@NotNull
CfnEventSourceMappingProps props)
scope - - scope in which this resource is defined. This parameter is required.id - - scoped id of the resource. This parameter is required.props - - resource properties. This parameter is required.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull public String getAttrId()
@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @NotNull public String getFunctionName()
Name formats - Function name – MyFunction .
arn:aws:lambda:us-west-2:123456789012:function:MyFunction .arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD .123456789012:function:MyFunction .The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.
@Stability(value=Stable)
public void setFunctionName(@NotNull
String value)
Name formats - Function name – MyFunction .
arn:aws:lambda:us-west-2:123456789012:function:MyFunction .arn:aws:lambda:us-west-2:123456789012:function:MyFunction:PROD .123456789012:function:MyFunction .The length constraint applies only to the full ARN. If you specify only the function name, it's limited to 64 characters in length.
@Stability(value=Stable) @Nullable public Object getAmazonManagedKafkaEventSourceConfig()
@Stability(value=Stable)
public void setAmazonManagedKafkaEventSourceConfig(@Nullable
IResolvable value)
@Stability(value=Stable)
public void setAmazonManagedKafkaEventSourceConfig(@Nullable
CfnEventSourceMapping.AmazonManagedKafkaEventSourceConfigProperty value)
@Stability(value=Stable) @Nullable public Number getBatchSize()
Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).
@Stability(value=Stable)
public void setBatchSize(@Nullable
Number value)
Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).
@Stability(value=Stable) @Nullable public Object getBisectBatchOnFunctionError()
The default value is false.
@Stability(value=Stable)
public void setBisectBatchOnFunctionError(@Nullable
Boolean value)
The default value is false.
@Stability(value=Stable)
public void setBisectBatchOnFunctionError(@Nullable
IResolvable value)
The default value is false.
@Stability(value=Stable) @Nullable public Object getDestinationConfig()
@Stability(value=Stable)
public void setDestinationConfig(@Nullable
IResolvable value)
@Stability(value=Stable)
public void setDestinationConfig(@Nullable
CfnEventSourceMapping.DestinationConfigProperty value)
@Stability(value=Stable) @Nullable public Object getDocumentDbEventSourceConfig()
@Stability(value=Stable)
public void setDocumentDbEventSourceConfig(@Nullable
IResolvable value)
@Stability(value=Stable)
public void setDocumentDbEventSourceConfig(@Nullable
CfnEventSourceMapping.DocumentDBEventSourceConfigProperty value)
@Stability(value=Stable) @Nullable public Object getEnabled()
Default: True
@Stability(value=Stable)
public void setEnabled(@Nullable
Boolean value)
Default: True
@Stability(value=Stable)
public void setEnabled(@Nullable
IResolvable value)
Default: True
@Stability(value=Stable) @Nullable public String getEventSourceArn()
@Stability(value=Stable)
public void setEventSourceArn(@Nullable
String value)
@Stability(value=Stable) @Nullable public Object getFilterCriteria()
For more information, see Lambda event filtering .
@Stability(value=Stable)
public void setFilterCriteria(@Nullable
IResolvable value)
For more information, see Lambda event filtering .
@Stability(value=Stable)
public void setFilterCriteria(@Nullable
CfnEventSourceMapping.FilterCriteriaProperty value)
For more information, see Lambda event filtering .
@Stability(value=Stable) @Nullable public List<String> getFunctionResponseTypes()
Valid Values: ReportBatchItemFailures
@Stability(value=Stable)
public void setFunctionResponseTypes(@Nullable
List<String> value)
Valid Values: ReportBatchItemFailures
@Stability(value=Stable) @Nullable public Number getMaximumBatchingWindowInSeconds()
Default ( Kinesis , DynamoDB , Amazon SQS event sources) : 0
Default ( Amazon MSK , Kafka, Amazon MQ , Amazon DocumentDB event sources) : 500 ms
Related setting: For Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.
@Stability(value=Stable)
public void setMaximumBatchingWindowInSeconds(@Nullable
Number value)
Default ( Kinesis , DynamoDB , Amazon SQS event sources) : 0
Default ( Amazon MSK , Kafka, Amazon MQ , Amazon DocumentDB event sources) : 500 ms
Related setting: For Amazon SQS event sources, when you set BatchSize to a value greater than 10, you must set MaximumBatchingWindowInSeconds to at least 1.
@Stability(value=Stable) @Nullable public Number getMaximumRecordAgeInSeconds()
The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.
The minimum valid value for maximum record age is 60s. Although values less than 60 and greater than -1 fall within the parameter's absolute range, they are not allowed
@Stability(value=Stable)
public void setMaximumRecordAgeInSeconds(@Nullable
Number value)
The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records.
The minimum valid value for maximum record age is 60s. Although values less than 60 and greater than -1 fall within the parameter's absolute range, they are not allowed
@Stability(value=Stable) @Nullable public Number getMaximumRetryAttempts()
The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.
@Stability(value=Stable)
public void setMaximumRetryAttempts(@Nullable
Number value)
The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.
@Stability(value=Stable) @Nullable public Number getParallelizationFactor()
The default value is 1.
@Stability(value=Stable)
public void setParallelizationFactor(@Nullable
Number value)
The default value is 1.
@Stability(value=Stable) @Nullable public List<String> getQueues()
@Stability(value=Stable)
public void setQueues(@Nullable
List<String> value)
@Stability(value=Stable) @Nullable public Object getScalingConfig()
For more information, see Configuring maximum concurrency for Amazon SQS event sources .
@Stability(value=Stable)
public void setScalingConfig(@Nullable
IResolvable value)
For more information, see Configuring maximum concurrency for Amazon SQS event sources .
@Stability(value=Stable)
public void setScalingConfig(@Nullable
CfnEventSourceMapping.ScalingConfigProperty value)
For more information, see Configuring maximum concurrency for Amazon SQS event sources .
@Stability(value=Stable) @Nullable public Object getSelfManagedEventSource()
@Stability(value=Stable)
public void setSelfManagedEventSource(@Nullable
IResolvable value)
@Stability(value=Stable)
public void setSelfManagedEventSource(@Nullable
CfnEventSourceMapping.SelfManagedEventSourceProperty value)
@Stability(value=Stable) @Nullable public Object getSelfManagedKafkaEventSourceConfig()
@Stability(value=Stable)
public void setSelfManagedKafkaEventSourceConfig(@Nullable
IResolvable value)
@Stability(value=Stable)
public void setSelfManagedKafkaEventSourceConfig(@Nullable
CfnEventSourceMapping.SelfManagedKafkaEventSourceConfigProperty value)
@Stability(value=Stable) @Nullable public Object getSourceAccessConfigurations()
@Stability(value=Stable)
public void setSourceAccessConfigurations(@Nullable
IResolvable value)
@Stability(value=Stable)
public void setSourceAccessConfigurations(@Nullable
List<Object> value)
@Stability(value=Stable) @Nullable public String getStartingPosition()
@Stability(value=Stable)
public void setStartingPosition(@Nullable
String value)
@Stability(value=Stable) @Nullable public Number getStartingPositionTimestamp()
@Stability(value=Stable)
public void setStartingPositionTimestamp(@Nullable
Number value)
@Stability(value=Stable) @Nullable public List<String> getTopics()
@Stability(value=Stable)
public void setTopics(@Nullable
List<String> value)
@Stability(value=Stable) @Nullable public Number getTumblingWindowInSeconds()
A value of 0 seconds indicates no tumbling window.
@Stability(value=Stable)
public void setTumblingWindowInSeconds(@Nullable
Number value)
A value of 0 seconds indicates no tumbling window.
Copyright © 2023. All rights reserved.