Class ManagedKafkaEventSource
Use a MSK cluster as a streaming source for AWS Lambda.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.Lambda.EventSources
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ManagedKafkaEventSource : StreamEventSource, IEventSource
Syntax (vb)
Public Class ManagedKafkaEventSource
Inherits StreamEventSource
Implements IEventSource
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.SecretsManager;
using Amazon.CDK.AWS.Lambda.EventSources;
Function myFunction;
// Your MSK cluster arn
var clusterArn = "arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4";
// The Kafka topic you want to subscribe to
var 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
var secret = new Secret(this, "Secret", new SecretProps { SecretName = "AmazonMSK_KafkaSecret" });
myFunction.AddEventSource(new ManagedKafkaEventSource(new ManagedKafkaEventSourceProps {
ClusterArn = clusterArn,
Topic = topic,
Secret = secret,
BatchSize = 100, // default
StartingPosition = StartingPosition.TRIM_HORIZON
}));
Synopsis
Constructors
ManagedKafkaEventSource(IManagedKafkaEventSourceProps) | |
ManagedKafkaEventSource(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
ManagedKafkaEventSource(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
EventSourceMappingArn | The ARN for this EventSourceMapping. |
EventSourceMappingId | The identifier for this EventSourceMapping. |
Methods
Bind(IFunction) | Called by |
Constructors
ManagedKafkaEventSource(IManagedKafkaEventSourceProps)
public ManagedKafkaEventSource(IManagedKafkaEventSourceProps props)
Parameters
ManagedKafkaEventSource(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected ManagedKafkaEventSource(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
ManagedKafkaEventSource(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected ManagedKafkaEventSource(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
EventSourceMappingArn
The ARN for this EventSourceMapping.
public virtual string EventSourceMappingArn { get; }
Property Value
System.String
EventSourceMappingId
The identifier for this EventSourceMapping.
public virtual string EventSourceMappingId { get; }
Property Value
System.String
Methods
Bind(IFunction)
Called by lambda.addEventSource
to allow the event source to bind to this function.
public override void Bind(IFunction target)
Parameters
- target IFunction