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.84.0 (build 5404dcf)",
date="2023-06-19T16:30:46.832Z")
@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 classA fluent builder forManagedKafkaEventSource.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.lambda.IEventSource
IEventSource.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedManagedKafkaEventSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedManagedKafkaEventSource(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled bylambda.addEventSourceto allow the event source to bind to this function.The identifier for this EventSourceMapping.Methods inherited from class software.amazon.awscdk.services.lambda.eventsources.StreamEventSource
enrichMappingOptions, getPropsMethods 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, toString, wait, wait, waitMethods 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.addEventSourceto allow the event source to bind to this function.- Specified by:
bindin interfaceIEventSource- Specified by:
bindin classStreamEventSource- Parameters:
target- This parameter is required.
-
getEventSourceMappingId
The identifier for this EventSourceMapping.
-