Class CfnEventSourceMapping
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.lambda.CfnEventSourceMapping
- All Implemented Interfaces:
IInspectable
,ITaggableV2
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.106.0 (build e852934)",
date="2025-02-12T12:32:05.039Z")
@Stability(Stable)
public class CfnEventSourceMapping
extends CfnResource
implements IInspectable, ITaggableV2
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.
- Configuring a Dynamo DB stream as an event source
- Configuring a Kinesis stream as an event source
- Configuring an SQS queue as an event source
- Configuring an MQ broker as an event source
- Configuring MSK as an event source
- Configuring Self-Managed Apache Kafka as an event source
- Configuring Amazon DocumentDB as an 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")) .kmsKeyArn("kmsKeyArn") .maximumBatchingWindowInSeconds(123) .maximumRecordAgeInSeconds(123) .maximumRetryAttempts(123) .metricsConfig(MetricsConfigProperty.builder() .metrics(List.of("metrics")) .build()) .parallelizationFactor(123) .provisionedPollerConfig(ProvisionedPollerConfigProperty.builder() .maximumPollers(123) .minimumPollers(123) .build()) .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) .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .topics(List.of("topics")) .tumblingWindowInSeconds(123) .build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.static final class
A fluent builder forCfnEventSourceMapping
.static interface
A configuration object that specifies the destination of an event after Lambda processes it.static interface
Specific configuration settings for a DocumentDB event source.static interface
The list of bootstrap servers for your Kafka brokers in the following format:"KafkaBootstrapServers": ["abc.xyz.com:xxxx","abc2.xyz.com:xxxx"]
.static interface
An object that contains the filters for an event source.static interface
A structure within aFilterCriteria
object that defines an event filtering pattern.static interface
The metrics configuration for your event source.static interface
A destination for events that failed processing.static interface
The provisioned mode configuration for the event source.static interface
(Amazon SQS only) The scaling configuration for the event source.static interface
The self-managed Apache Kafka cluster for your event source.static interface
Specific configuration settings for a self-managed Apache Kafka event source.static interface
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggableV2
ITaggableV2.Jsii$Default, ITaggableV2.Jsii$Proxy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CfnEventSourceMapping
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnEventSourceMapping
(software.amazon.jsii.JsiiObjectRef objRef) CfnEventSourceMapping
(software.constructs.Construct scope, String id, CfnEventSourceMappingProps props) -
Method Summary
Modifier and TypeMethodDescriptionSpecific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.The Amazon Resource Name (ARN) of the event source mapping.The event source mapping's ID.The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function.(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry.Tag Manager which manages the tags for this resource.(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka event sources only) A configuration object that specifies the destination of an event after Lambda processes it.Specific configuration settings for a DocumentDB event source.When true, the event source mapping is active.The Amazon Resource Name (ARN) of the event source.An object that defines the filter criteria that determine whether Lambda should process an event.The name or ARN of the Lambda function.(Kinesis, DynamoDB Streams, and SQS) A list of current response type enums applied to the event source mapping.The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that Lambda uses to encrypt your function's filter criteria .The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function.(Kinesis and DynamoDB Streams only) Discard records older than the specified age.(Kinesis and DynamoDB Streams only) Discard records after the specified number of retries.The metrics configuration for your event source.(Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard.(Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source.(Amazon MQ) The name of the Amazon MQ broker destination queue to consume.(Amazon SQS only) The scaling configuration for the event source.The self-managed Apache Kafka cluster for your event source.Specific configuration settings for a self-managed Apache Kafka event source.An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.The position in a stream from which to start reading.WithStartingPosition
set toAT_TIMESTAMP
, the time from which to start reading, in Unix time seconds.getTags()
A list of tags to add to the event source mapping.The name of the Kafka topic.(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.renderProperties
(Map<String, Object> props) void
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source.void
setAmazonManagedKafkaEventSourceConfig
(CfnEventSourceMapping.AmazonManagedKafkaEventSourceConfigProperty 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
(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry.void
(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry.void
setDestinationConfig
(IResolvable value) (Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka event sources only) A configuration object that specifies the destination of an event after Lambda processes it.void
(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka event sources only) A configuration object that specifies the destination of an event after Lambda processes it.void
Specific configuration settings for a DocumentDB event source.void
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
(IResolvable value) An object that defines the filter criteria that determine whether Lambda should process an event.void
An object that defines the filter criteria that determine whether Lambda should process an event.void
setFunctionName
(String value) The name or ARN of the Lambda function.void
setFunctionResponseTypes
(List<String> value) (Kinesis, DynamoDB Streams, and SQS) A list of current response type enums applied to the event source mapping.void
setKmsKeyArn
(String value) The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that Lambda uses to encrypt your function's filter criteria .void
The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function.void
(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
setMetricsConfig
(IResolvable value) The metrics configuration for your event source.void
The metrics configuration for your event source.void
setParallelizationFactor
(Number value) (Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard.void
(Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source.void
(Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source.void
(Amazon MQ) The name of the Amazon MQ broker destination queue to consume.void
setScalingConfig
(IResolvable value) (Amazon SQS only) The scaling configuration for the event source.void
(Amazon SQS only) The scaling configuration for the event source.void
The self-managed Apache Kafka cluster for your event source.void
The self-managed Apache Kafka cluster for your event source.void
Specific configuration settings for a self-managed Apache Kafka event source.void
setSelfManagedKafkaEventSourceConfig
(CfnEventSourceMapping.SelfManagedKafkaEventSourceConfigProperty value) Specific configuration settings for a self-managed Apache Kafka 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
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
WithStartingPosition
set toAT_TIMESTAMP
, the time from which to start reading, in Unix time seconds.void
A list of tags to add to the event source mapping.void
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.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnEventSourceMapping
protected CfnEventSourceMapping(software.amazon.jsii.JsiiObjectRef objRef) -
CfnEventSourceMapping
protected CfnEventSourceMapping(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnEventSourceMapping
@Stability(Stable) public CfnEventSourceMapping(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnEventSourceMappingProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrEventSourceMappingArn
The Amazon Resource Name (ARN) of the event source mapping. -
getAttrId
The event source mapping's ID. -
getCdkTagManager
Tag Manager which manages the tags for this resource.- Specified by:
getCdkTagManager
in interfaceITaggableV2
-
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getFunctionName
The name or ARN of the Lambda function. -
setFunctionName
The name or ARN of the Lambda function. -
getAmazonManagedKafkaEventSourceConfig
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source. -
setAmazonManagedKafkaEventSourceConfig
Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source. -
setAmazonManagedKafkaEventSourceConfig
@Stability(Stable) public void setAmazonManagedKafkaEventSourceConfig(@Nullable CfnEventSourceMapping.AmazonManagedKafkaEventSourceConfigProperty value) Specific configuration settings for an Amazon Managed Streaming for Apache Kafka (Amazon MSK) event source. -
getBatchSize
The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. -
setBatchSize
The maximum number of records in each batch that Lambda pulls from your stream or queue and sends to your function. -
getBisectBatchOnFunctionError
(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry. -
setBisectBatchOnFunctionError
(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry. -
setBisectBatchOnFunctionError
(Kinesis and DynamoDB Streams only) If the function returns an error, split the batch in two and retry. -
getDestinationConfig
(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka event sources only) A configuration object that specifies the destination of an event after Lambda processes it. -
setDestinationConfig
(Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka event sources only) A configuration object that specifies the destination of an event after Lambda processes it. -
setDestinationConfig
@Stability(Stable) public void setDestinationConfig(@Nullable CfnEventSourceMapping.DestinationConfigProperty value) (Kinesis, DynamoDB Streams, Amazon MSK, and self-managed Apache Kafka event sources only) A configuration object that specifies the destination of an event after Lambda processes it. -
getDocumentDbEventSourceConfig
Specific configuration settings for a DocumentDB event source. -
setDocumentDbEventSourceConfig
Specific configuration settings for a DocumentDB event source. -
setDocumentDbEventSourceConfig
@Stability(Stable) public void setDocumentDbEventSourceConfig(@Nullable CfnEventSourceMapping.DocumentDBEventSourceConfigProperty value) Specific configuration settings for a DocumentDB event source. -
getEnabled
When true, the event source mapping is active.When false, Lambda pauses polling and invocation.
-
setEnabled
When true, the event source mapping is active.When false, Lambda pauses polling and invocation.
-
setEnabled
When true, the event source mapping is active.When false, Lambda pauses polling and invocation.
-
getEventSourceArn
The Amazon Resource Name (ARN) of the event source. -
setEventSourceArn
The Amazon Resource Name (ARN) of the event source. -
getFilterCriteria
An object that defines the filter criteria that determine whether Lambda should process an event. -
setFilterCriteria
An object that defines the filter criteria that determine whether Lambda should process an event. -
setFilterCriteria
@Stability(Stable) public void setFilterCriteria(@Nullable CfnEventSourceMapping.FilterCriteriaProperty value) An object that defines the filter criteria that determine whether Lambda should process an event. -
getFunctionResponseTypes
(Kinesis, DynamoDB Streams, and SQS) A list of current response type enums applied to the event source mapping. -
setFunctionResponseTypes
(Kinesis, DynamoDB Streams, and SQS) A list of current response type enums applied to the event source mapping. -
getKmsKeyArn
The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that Lambda uses to encrypt your function's filter criteria . -
setKmsKeyArn
The ARN of the AWS Key Management Service ( AWS KMS ) customer managed key that Lambda uses to encrypt your function's filter criteria . -
getMaximumBatchingWindowInSeconds
The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. -
setMaximumBatchingWindowInSeconds
The maximum amount of time, in seconds, that Lambda spends gathering records before invoking the function. -
getMaximumRecordAgeInSeconds
(Kinesis and DynamoDB Streams only) Discard records older than the specified age. -
setMaximumRecordAgeInSeconds
(Kinesis and DynamoDB Streams only) Discard records older than the specified age. -
getMaximumRetryAttempts
(Kinesis and DynamoDB Streams only) Discard records after the specified number of retries. -
setMaximumRetryAttempts
(Kinesis and DynamoDB Streams only) Discard records after the specified number of retries. -
getMetricsConfig
The metrics configuration for your event source. -
setMetricsConfig
The metrics configuration for your event source. -
setMetricsConfig
@Stability(Stable) public void setMetricsConfig(@Nullable CfnEventSourceMapping.MetricsConfigProperty value) The metrics configuration for your event source. -
getParallelizationFactor
(Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard. -
setParallelizationFactor
(Kinesis and DynamoDB Streams only) The number of batches to process concurrently from each shard. -
getProvisionedPollerConfig
(Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source. -
setProvisionedPollerConfig
(Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source. -
setProvisionedPollerConfig
@Stability(Stable) public void setProvisionedPollerConfig(@Nullable CfnEventSourceMapping.ProvisionedPollerConfigProperty value) (Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source. -
getQueues
(Amazon MQ) The name of the Amazon MQ broker destination queue to consume. -
setQueues
(Amazon MQ) The name of the Amazon MQ broker destination queue to consume. -
getScalingConfig
(Amazon SQS only) The scaling configuration for the event source. -
setScalingConfig
(Amazon SQS only) The scaling configuration for the event source. -
setScalingConfig
@Stability(Stable) public void setScalingConfig(@Nullable CfnEventSourceMapping.ScalingConfigProperty value) (Amazon SQS only) The scaling configuration for the event source. -
getSelfManagedEventSource
The self-managed Apache Kafka cluster for your event source. -
setSelfManagedEventSource
The self-managed Apache Kafka cluster for your event source. -
setSelfManagedEventSource
@Stability(Stable) public void setSelfManagedEventSource(@Nullable CfnEventSourceMapping.SelfManagedEventSourceProperty value) The self-managed Apache Kafka cluster for your event source. -
getSelfManagedKafkaEventSourceConfig
Specific configuration settings for a self-managed Apache Kafka event source. -
setSelfManagedKafkaEventSourceConfig
Specific configuration settings for a self-managed Apache Kafka event source. -
setSelfManagedKafkaEventSourceConfig
@Stability(Stable) public void setSelfManagedKafkaEventSourceConfig(@Nullable CfnEventSourceMapping.SelfManagedKafkaEventSourceConfigProperty value) Specific configuration settings for a self-managed Apache Kafka event source. -
getSourceAccessConfigurations
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source. -
setSourceAccessConfigurations
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source. -
setSourceAccessConfigurations
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source. -
getStartingPosition
The position in a stream from which to start reading.Required for Amazon Kinesis and Amazon DynamoDB.
-
setStartingPosition
The position in a stream from which to start reading.Required for Amazon Kinesis and Amazon DynamoDB.
-
getStartingPositionTimestamp
WithStartingPosition
set toAT_TIMESTAMP
, the time from which to start reading, in Unix time seconds. -
setStartingPositionTimestamp
WithStartingPosition
set toAT_TIMESTAMP
, the time from which to start reading, in Unix time seconds. -
getTags
A list of tags to add to the event source mapping. -
setTags
A list of tags to add to the event source mapping. -
getTopics
The name of the Kafka topic. -
setTopics
The name of the Kafka topic. -
getTumblingWindowInSeconds
(Kinesis and DynamoDB Streams only) The duration in seconds of a processing window for DynamoDB and Kinesis Streams event sources. -
setTumblingWindowInSeconds
(Kinesis and DynamoDB Streams only) The duration in seconds of a processing window for DynamoDB and Kinesis Streams event sources.
-