Class ManagedKafkaEventSource
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.lambda.eventsources.StreamEventSource
software.amazon.awscdk.services.lambda.eventsources.ManagedKafkaEventSource
- All Implemented Interfaces:
IEventSource
,software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)",
date="2024-08-15T01:32:50.474Z")
@Stability(Stable)
public class ManagedKafkaEventSource
extends StreamEventSource
Use a MSK cluster as a streaming source for AWS Lambda.
Example:
import software.amazon.awscdk.services.secretsmanager.Secret; import software.amazon.awscdk.services.lambda.eventsources.ManagedKafkaEventSource; Function myFunction; // Your MSK cluster arn String clusterArn = "arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4"; // The Kafka topic you want to subscribe to String topic = "some-cool-topic"; // The secret that allows access to your MSK cluster // You still have to make sure that it is associated with your cluster as described in the documentation Secret secret = Secret.Builder.create(this, "Secret").secretName("AmazonMSK_KafkaSecret").build(); myFunction.addEventSource(ManagedKafkaEventSource.Builder.create() .clusterArn(clusterArn) .topic(topic) .secret(secret) .batchSize(100) // default .startingPosition(StartingPosition.TRIM_HORIZON) .build());
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
A fluent builder forManagedKafkaEventSource
.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.lambda.IEventSource
IEventSource.Jsii$Default
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ManagedKafkaEventSource
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
ManagedKafkaEventSource
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called bylambda.addEventSource
to allow the event source to bind to this function.The ARN for this EventSourceMapping.The identifier for this EventSourceMapping.Methods inherited from class software.amazon.awscdk.services.lambda.eventsources.StreamEventSource
enrichMappingOptions, getProps
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, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
ManagedKafkaEventSource
protected ManagedKafkaEventSource(software.amazon.jsii.JsiiObjectRef objRef) -
ManagedKafkaEventSource
protected ManagedKafkaEventSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
ManagedKafkaEventSource
- Parameters:
props
- This parameter is required.
-
-
Method Details
-
bind
Called bylambda.addEventSource
to allow the event source to bind to this function.- Specified by:
bind
in interfaceIEventSource
- Specified by:
bind
in classStreamEventSource
- Parameters:
target
- This parameter is required.
-
getEventSourceMappingArn
The ARN for this EventSourceMapping. -
getEventSourceMappingId
The identifier for this EventSourceMapping.
-