Class SelfManagedKafkaEventSourceProps
Properties for a self managed Kafka cluster event source.
Inheritance
Namespace: Amazon.CDK.AWS.Lambda.EventSources
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class SelfManagedKafkaEventSourceProps : Object, ISelfManagedKafkaEventSourceProps, IKafkaEventSourceProps, IBaseStreamEventSourceProps
Syntax (vb)
Public Class SelfManagedKafkaEventSourceProps
Inherits Object
Implements ISelfManagedKafkaEventSourceProps, IKafkaEventSourceProps, IBaseStreamEventSourceProps
Remarks
If your Kafka cluster is only reachable via VPC make sure to configure it.
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.SecretsManager;
using Amazon.CDK.AWS.Lambda.EventSources;
// The secret that allows access to your self hosted Kafka cluster
Secret secret;
Function myFunction;
// The list of Kafka brokers
var bootstrapServers = new [] { "kafka-broker:9092" };
// The Kafka topic you want to subscribe to
var topic = "some-cool-topic";
// (Optional) The consumer group id to use when connecting to the Kafka broker. If omitted the UUID of the event source mapping will be used.
var consumerGroupId = "my-consumer-group-id";
myFunction.AddEventSource(new SelfManagedKafkaEventSource(new SelfManagedKafkaEventSourceProps {
BootstrapServers = bootstrapServers,
Topic = topic,
ConsumerGroupId = consumerGroupId,
Secret = secret,
BatchSize = 100, // default
StartingPosition = StartingPosition.TRIM_HORIZON
}));
Synopsis
Constructors
SelfManagedKafkaEventSourceProps() |
Properties
AuthenticationMethod | The authentication method for your Kafka cluster. |
BatchSize | The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. |
BootstrapServers | The list of host and port pairs that are the addresses of the Kafka brokers in a "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap itself. |
ConsumerGroupId | The identifier for the Kafka consumer group to join. |
Enabled | If the stream event source mapping should be enabled. |
Filters | Add filter criteria to Event Source. |
MaxBatchingWindow | The maximum amount of time to gather records before invoking the function. |
OnFailure | Add an on Failure Destination for this Kafka event. |
RootCACertificate | The secret with the root CA certificate used by your Kafka brokers for TLS encryption This field is required if your Kafka brokers use certificates signed by a private CA. |
Secret | The secret with the Kafka credentials, see https://docs.aws.amazon.com/msk/latest/developerguide/msk-password.html for details This field is required if your Kafka brokers are accessed over the Internet. |
SecurityGroup | If your Kafka brokers are only reachable via VPC, provide the security group here. |
StartingPosition | Where to begin consuming the stream. |
Topic | The Kafka topic to subscribe to. |
Vpc | If your Kafka brokers are only reachable via VPC provide the VPC here. |
VpcSubnets | If your Kafka brokers are only reachable via VPC, provide the subnets selection here. |
Constructors
SelfManagedKafkaEventSourceProps()
public SelfManagedKafkaEventSourceProps()
Properties
AuthenticationMethod
The authentication method for your Kafka cluster.
public Nullable<AuthenticationMethod> AuthenticationMethod { get; set; }
Property Value
System.Nullable<AuthenticationMethod>
Remarks
Default: AuthenticationMethod.SASL_SCRAM_512_AUTH
BatchSize
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.
public Nullable<double> BatchSize { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Your function receives an event with all the retrieved records.
Valid Range:
Default: 100
BootstrapServers
The list of host and port pairs that are the addresses of the Kafka brokers in a "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap itself.
public string[] BootstrapServers { get; set; }
Property Value
System.String[]
Remarks
They are in the format abc.xyz.com:xxxx
.
ConsumerGroupId
The identifier for the Kafka consumer group to join.
public string ConsumerGroupId { get; set; }
Property Value
System.String
Remarks
The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. The value must have a lenght between 1 and 200 and full the pattern '[a-zA-Z0-9-/:_+=.@-]'.
Default: - none
See: https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-consumer-group-id
Enabled
If the stream event source mapping should be enabled.
public Nullable<bool> Enabled { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: true
Filters
Add filter criteria to Event Source.
public IDictionary<string, object>[] Filters { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>[]
Remarks
Default: - none
See: https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventfiltering.html
MaxBatchingWindow
The maximum amount of time to gather records before invoking the function.
public Duration MaxBatchingWindow { get; set; }
Property Value
Remarks
Maximum of Duration.minutes(5).
Default: - Duration.seconds(0) for Kinesis, DynamoDB, and SQS event sources, Duration.millis(500) for MSK, self-managed Kafka, and Amazon MQ.
OnFailure
Add an on Failure Destination for this Kafka event.
public IEventSourceDlq OnFailure { get; set; }
Property Value
Remarks
SNS/SQS/S3 are supported
Default: - discarded records are ignored
RootCACertificate
The secret with the root CA certificate used by your Kafka brokers for TLS encryption This field is required if your Kafka brokers use certificates signed by a private CA.
public ISecret RootCACertificate { get; set; }
Property Value
Remarks
Default: - none
Secret
The secret with the Kafka credentials, see https://docs.aws.amazon.com/msk/latest/developerguide/msk-password.html for details This field is required if your Kafka brokers are accessed over the Internet.
public ISecret Secret { get; set; }
Property Value
Remarks
Default: none
SecurityGroup
If your Kafka brokers are only reachable via VPC, provide the security group here.
public ISecurityGroup SecurityGroup { get; set; }
Property Value
Remarks
Default: - none, required if setting vpc
StartingPosition
Where to begin consuming the stream.
public StartingPosition StartingPosition { get; set; }
Property Value
Topic
The Kafka topic to subscribe to.
public string Topic { get; set; }
Property Value
System.String
Vpc
If your Kafka brokers are only reachable via VPC provide the VPC here.
public IVpc Vpc { get; set; }
Property Value
Remarks
Default: none
VpcSubnets
If your Kafka brokers are only reachable via VPC, provide the subnets selection here.
public ISubnetSelection VpcSubnets { get; set; }
Property Value
Remarks
Default: - none, required if setting vpc