Class EventSourceMapping
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.lambda.EventSourceMapping
- All Implemented Interfaces:
IConstruct,IDependable,IResource,IEventSourceMapping,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:40.729Z")
@Stability(Stable)
public class EventSourceMapping
extends Resource
implements IEventSourceMapping
Defines a Lambda EventSourceMapping resource.
Usually, you won't need to define the mapping yourself. This will usually be done by event sources. For example, to add an SQS event source to a function:
import { SqsEventSource } from '@aws-cdk/aws-lambda-event-sources';
lambda.addEventSource(new SqsEventSource(sqs));
The SqsEventSource class will automatically create the mapping, and will also
modify the Lambda's execution role so it can consume messages from the queue.
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.*;
import software.amazon.awscdk.core.*;
IEventSourceDlq eventSourceDlq;
Function function_;
SourceAccessConfigurationType sourceAccessConfigurationType;
EventSourceMapping eventSourceMapping = EventSourceMapping.Builder.create(this, "MyEventSourceMapping")
.target(function_)
// the properties below are optional
.batchSize(123)
.bisectBatchOnError(false)
.enabled(false)
.eventSourceArn("eventSourceArn")
.kafkaBootstrapServers(List.of("kafkaBootstrapServers"))
.kafkaTopic("kafkaTopic")
.maxBatchingWindow(Duration.minutes(30))
.maxRecordAge(Duration.minutes(30))
.onFailure(eventSourceDlq)
.parallelizationFactor(123)
.reportBatchItemFailures(false)
.retryAttempts(123)
.sourceAccessConfigurations(List.of(SourceAccessConfiguration.builder()
.type(sourceAccessConfigurationType)
.uri("uri")
.build()))
.startingPosition(StartingPosition.TRIM_HORIZON)
.tumblingWindow(Duration.minutes(30))
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.lambda.IEventSourceMapping
IEventSourceMapping.Jsii$Default, IEventSourceMapping.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.core.IResource
IResource.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEventSourceMapping(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedEventSourceMapping(software.amazon.jsii.JsiiObjectRef objRef) EventSourceMapping(software.constructs.Construct scope, String id, EventSourceMappingProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic IEventSourceMappingfromEventSourceMappingId(software.constructs.Construct scope, String id, String eventSourceMappingId) Import an event source into this stack from its event source id.The identifier for this EventSourceMapping.Methods inherited from class software.amazon.awscdk.core.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourceMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods inherited from class software.constructs.Construct
toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.core.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.core.IResource
applyRemovalPolicy, getEnv, getStackMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
EventSourceMapping
protected EventSourceMapping(software.amazon.jsii.JsiiObjectRef objRef) -
EventSourceMapping
protected EventSourceMapping(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
EventSourceMapping
@Stability(Stable) public EventSourceMapping(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull EventSourceMappingProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
fromEventSourceMappingId
@Stability(Stable) @NotNull public static IEventSourceMapping fromEventSourceMappingId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String eventSourceMappingId) Import an event source into this stack from its event source id.- Parameters:
scope- This parameter is required.id- This parameter is required.eventSourceMappingId- This parameter is required.
-
getEventSourceMappingId
The identifier for this EventSourceMapping.- Specified by:
getEventSourceMappingIdin interfaceIEventSourceMapping
-