Class StartingPosition
The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading.
Inheritance
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public sealed class StartingPosition : Enum
Syntax (vb)
Public NotInheritable Class StartingPosition
Inherits
Enum
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
Fields
AT_TIMESTAMP | Start reading from a position defined by a time stamp. |
LATEST | Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard. |
TRIM_HORIZON | Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard. |
value__ |
Fields
AT_TIMESTAMP
Start reading from a position defined by a time stamp.
public const StartingPosition AT_TIMESTAMP
Field Value
Type | Description |
---|---|
StartingPosition |
Remarks
Only supported for Amazon Kinesis streams, otherwise an error will occur.
If supplied, startingPositionTimestamp
must also be set.
LATEST
Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard.
public const StartingPosition LATEST
Field Value
Type | Description |
---|---|
StartingPosition |
TRIM_HORIZON
Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.
public const StartingPosition TRIM_HORIZON
Field Value
Type | Description |
---|---|
StartingPosition |
value__
public int value__
Field Value
Type | Description |
---|---|
System.Int32 |