Skip to content

Feature request: Kafka Event Data Class #1484

Description

@lyoung-confluent

Use case

When using a Kafka event source either from self-managed Apache Kafka or Amazon MSK there should be a relevant data class for easy iteration/decoding.

Such functionality is implemented already in aws-lambda-go and in aws-lambda-java-libs.

Solution/User Experience

Similar to other streaming data sources a records property should be iterable returning a KafkaEventRecord that transparently decodes the values from JSON:

from aws_lambda_powertools.utilities.data_classes import event_source, KafkaEvent

@event_source(data_class=KafkaEvent)
def handler(event: KafkaEvent, context: LambdaContext):
	for record in event.records:
		print(record.decoded_key, record.json_value)

Alternative solutions

No response

Acknowledgment

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions