StartingPosition

class aws_cdk.aws_lambda.StartingPosition(value)

Bases: enum.Enum

The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading.

Example:

from aws_cdk.aws_secretsmanager import Secret
from aws_cdk.aws_lambda_event_sources import SelfManagedKafkaEventSource

# The secret that allows access to your self hosted Kafka cluster
# secret is of type Secret

# my_function is of type Function


# The list of Kafka brokers
bootstrap_servers = ["kafka-broker:9092"]

# The Kafka topic you want to subscribe to
topic = "some-cool-topic"
my_function.add_event_source(SelfManagedKafkaEventSource(
    bootstrap_servers=bootstrap_servers,
    topic=topic,
    secret=secret,
    batch_size=100,  # default
    starting_position=lambda_.StartingPosition.TRIM_HORIZON
))

Attributes

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.