ProvisionedPollerConfig

class aws_cdk.aws_lambda_event_sources.ProvisionedPollerConfig(*, maximum_pollers, minimum_pollers)

Bases: object

(Amazon MSK and self-managed Apache Kafka only) The provisioned mode configuration for the event source.

Parameters:
  • maximum_pollers (Union[int, float]) – The maximum number of pollers that can be provisioned. Default: 200

  • minimum_pollers (Union[int, float]) – The minimum number of pollers that should be provisioned. Default: 1

ExampleMetadata:

infused

Example:

from aws_cdk.aws_glue import CfnRegistry
from aws_cdk.aws_lambda_event_sources import ManagedKafkaEventSource, GlueSchemaRegistry

# Your MSK cluster arn
# cluster_arn: str

# my_function: lambda.Function


# The Kafka topic you want to subscribe to
topic = "some-cool-topic"

# Your Glue Schema Registry
glue_registry = CfnRegistry(self, "Registry",
    name="schema-registry",
    description="Schema registry for event source"
)
my_function.add_event_source(ManagedKafkaEventSource(
    cluster_arn=cluster_arn,
    topic=topic,
    starting_position=lambda_.StartingPosition.TRIM_HORIZON,
    provisioned_poller_config=ProvisionedPollerConfig(
        minimum_pollers=1,
        maximum_pollers=3
    ),
    schema_registry_config=GlueSchemaRegistry(
        schema_registry=glue_registry,
        event_record_format=lambda_.EventRecordFormat.JSON,
        schema_validation_configs=[lambda.KafkaSchemaValidationConfig(attribute=lambda_.KafkaSchemaValidationAttribute.KEY)]
    )
))

Attributes

maximum_pollers

The maximum number of pollers that can be provisioned.

Default:

200

minimum_pollers

The minimum number of pollers that should be provisioned.

Default:

1