@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:40.511Z") @Stability(value=Stable) public class ManagedKafkaEventSource extends StreamEventSource
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());
| Modifier and Type | Class and Description |
|---|---|
static class |
ManagedKafkaEventSource.Builder
A fluent builder for
ManagedKafkaEventSource. |
software.amazon.jsii.JsiiObject.InitializationModeIEventSource.Jsii$Default| Modifier | Constructor and Description |
|---|---|
protected |
ManagedKafkaEventSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
ManagedKafkaEventSource(software.amazon.jsii.JsiiObjectRef objRef) |
|
ManagedKafkaEventSource(ManagedKafkaEventSourceProps props) |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(IFunction target)
Called by `lambda.addEventSource` to allow the event source to bind to this function.
|
String |
getEventSourceMappingId()
The identifier for this EventSourceMapping.
|
enrichMappingOptions, getPropsjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected ManagedKafkaEventSource(software.amazon.jsii.JsiiObjectRef objRef)
protected ManagedKafkaEventSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public ManagedKafkaEventSource(@NotNull
ManagedKafkaEventSourceProps props)
props - This parameter is required.@Stability(value=Stable)
public void bind(@NotNull
IFunction target)
bind in interface IEventSourcebind in class StreamEventSourcetarget - This parameter is required.@Stability(value=Stable) @NotNull public String getEventSourceMappingId()
Copyright © 2022. All rights reserved.