Skip to content
v2.278.0

BaseStreamEventSourceProps Struct ​

The set of properties for streaming event sources shared by Dynamo, Kinesis and Kafka.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
import { aws_lambda_event_sources as lambda_event_sources } from 'aws-cdk-lib';
const baseStreamEventSourceProps: lambda_event_sources.BaseStreamEventSourceProps = {
  batchSize: 123,
  enabled: false,
  maxBatchingWindow: cdk.Duration.minutes(30),
  provisionedPollerConfig: {
    maximumPollers: 123,
    minimumPollers: 123,
    pollerGroupName: 'pollerGroupName',
  },
  startingPosition: lambda.StartingPosition.TRIM_HORIZON,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_lambda as lambda_
from aws_cdk import aws_lambda_event_sources as lambda_event_sources

base_stream_event_source_props = lambda_event_sources.BaseStreamEventSourceProps(
    batch_size=123,
    enabled=False,
    max_batching_window=cdk.Duration.minutes(30),
    provisioned_poller_config=lambda_event_sources.ProvisionedPollerConfig(
        maximum_pollers=123,
        minimum_pollers=123,
        poller_group_name="pollerGroupName"
    ),
    starting_position=lambda_.StartingPosition.TRIM_HORIZON
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.lambda.*;
import software.amazon.awscdk.services.lambda.eventsources.*;

BaseStreamEventSourceProps baseStreamEventSourceProps = BaseStreamEventSourceProps.builder()
        .batchSize(123)
        .enabled(false)
        .maxBatchingWindow(Duration.minutes(30))
        .provisionedPollerConfig(ProvisionedPollerConfig.builder()
                .maximumPollers(123)
                .minimumPollers(123)
                .pollerGroupName("pollerGroupName")
                .build())
        .startingPosition(StartingPosition.TRIM_HORIZON)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.Lambda;
using Amazon.CDK.AWS.Lambda.EventSources;

var baseStreamEventSourceProps = new BaseStreamEventSourceProps {
    BatchSize = 123,
    Enabled = false,
    MaxBatchingWindow = Duration.Minutes(30),
    ProvisionedPollerConfig = new ProvisionedPollerConfig {
        MaximumPollers = 123,
        MinimumPollers = 123,
        PollerGroupName = "pollerGroupName"
    },
    StartingPosition = StartingPosition.TRIM_HORIZON
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

baseStreamEventSourceProps := &BaseStreamEventSourceProps{
	BatchSize: jsii.Number(123),
	Enabled: jsii.Boolean(false),
	MaxBatchingWindow: cdk.Duration_Minutes(jsii.Number(30)),
	ProvisionedPollerConfig: &ProvisionedPollerConfig{
		MaximumPollers: jsii.Number(123),
		MinimumPollers: jsii.Number(123),
		PollerGroupName: jsii.String("pollerGroupName"),
	},
	StartingPosition: awscdk.Aws_lambda.StartingPosition_TRIM_HORIZON,
}

Properties ​

batchSizeoptionalnumberbatch_sizeoptionalint | floatbatchSizeoptionalNumberBatchSizeoptionaldoubleBatchSizeoptional*float64 = 100 #
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.
notes

Your function receives an event with all the retrieved records.

Valid Range:

  • Minimum value of 1
  • Maximum value of:
    • 1000 for DynamoEventSource
    • 10000 for KinesisEventSource, ManagedKafkaEventSource and SelfManagedKafkaEventSource
enabledoptionalbooleanenabledoptionalboolenabledoptionalBooleanEnabledoptionalboolEnabledoptional*bool = true #
If the stream event source mapping should be enabled.
maxBatchingWindowoptionalDurationmax_batching_windowoptionalDurationmaxBatchingWindowoptionalDurationMaxBatchingWindowoptionalDurationMaxBatchingWindowoptionalDuration #
The maximum amount of time to gather records before invoking the function.

Default: Duration.seconds(0) for Kinesis, DynamoDB, and SQS event sources, Duration.millis(500) for MSK, self-managed Kafka, and Amazon MQ.

Maximum of Duration.minutes(5).

provisionedPollerConfigoptionalProvisionedPollerConfigprovisioned_poller_configoptionalProvisionedPollerConfigprovisionedPollerConfigoptionalProvisionedPollerConfigProvisionedPollerConfigoptionalProvisionedPollerConfigProvisionedPollerConfigoptionalProvisionedPollerConfig #
Configuration for provisioned pollers that read from the event source.

Default: no provisioned pollers

When specified, allows control over the minimum and maximum number of pollers that can be provisioned to process events from the source.

startingPositionoptionalStartingPositionstarting_positionoptionalStartingPositionstartingPositionoptionalStartingPositionStartingPositionoptionalStartingPositionStartingPositionoptionalStartingPosition #
Where to begin consuming the stream.

Default: no starting position; synthesis fails if the event source requires one

Required for DynamoDB, Kinesis and Amazon MSK event sources, and for self-managed Kafka event sources unless consumptionMode is KafkaConsumptionMode.QUEUE. Not supported in queue mode.