v3.15.0
Summary
We're excited to announce the Kafka Consumer utility, which transparently handles message deserialization, provides an intuitive developer experience, and integrates seamlessly with the rest of the Powertools for AWS Lambda ecosystem.
Key features
- Automatic deserialization of Kafka messages (JSON, Avro, and Protocol Buffers)
- Simplified event record handling with intuitive interface
- Support for key and value deserialization
- Support for Pydantic models and Dataclass output
- Support for Event Source Mapping (ESM) with and without Schema Registry integration
- Out of the box error handling for deserialization issues
Getting Started
To get started, depending on the schema types you want to use, install the library and the corresponding libraries:
For JSON schemas:
pip install aws-lambda-powertools
For Avro schemas:
pip install 'aws-lambda-powertools[kafka-consumer-avro]'
For Protobuf schemas:
pip install 'aws-lambda-powertools[kafka-consumer-protobuf]'
Additionally, if you want to use output serialization with Pydantic Models or Dataclases
Processing Kafka events
You can use Kafka consumer utility to transform raw Kafka events into an intuitive format for processing.
The @kafka_consumer
decorator can deserialize both keys and values independently based on your schema configuration. This flexibility allows you to work with different data formats in the same message.
Custom output serializers
You can transform deserialized data into your preferred object types using output serializers. This can help you integrate Kafka data with your domain models and application architecture, providing type hints, validation, and structured data access.
Error handling
You can handle errors when processing Kafka messages to ensure your application maintains resilience and provides clear diagnostic information.
We lazily decode fields like value
, key
, and headers
only when accessed. This allows you to handle deserialization errors at the point of access rather than when the record is first processed.
Changes
🌟New features and non-breaking changes
- feat(kafka): add logic to handle protobuf deserialization (#6841) by @leandrodamascena
- feat(kafka): add support for Confluence Producers (#6833) by @leandrodamascena
- feat(kafka): New Kafka utility (#6821) by @leandrodamascena
📜 Documentation updates
- docs(kafka): add kafka documentation (#6834) by @leandrodamascena
- docs(public_reference): add Instil as a public reference (#6763) by @leandrodamascena
🐛 Bug and hot fixes
- fix(bedrock_agent): fix querystring field resolution (#6777) by @matteofigus
🔧 Maintenance
- chore(deps-dev): bump pytest-cov from 6.1.1 to 6.2.1 (#6800) by @dependabot[bot]
- feat(kafka): New Kafka utility (#6821) by @leandrodamascena
- chore(deps): bump protobuf from 6.31.0 to 6.31.1 (#6815) by @dependabot[bot]
- chore(deps-dev): bump aws-cdk from 2.1018.0 to 2.1018.1 (#6803) by @dependabot[bot]
- chore(deps-dev): bump boto3-stubs from 1.38.33 to 1.38.35 (#6796) by @dependabot[bot]
- chore(deps-dev): bump requests from 2.32.3 to 2.32.4 (#6789) by @dependabot[bot]
- chore(deps-dev): bump boto3-stubs from 1.38.31 to 1.38.33 (#6786) by @dependabot[bot]
- chore(deps-dev): bump requests from 2.32.3 to 2.32.4 (#6787) by @dependabot[bot]
- chore(deps-dev): bump ruff from 0.11.12 to 0.11.13 (#6780) by @dependabot[bot]
- chore(deps-dev): bump boto3-stubs from 1.38.30 to 1.38.31 (#6776) by @dependabot[bot]
- chore(deps-dev): bump aws-cdk from 2.1017.1 to 2.1018.0 (#6775) by @dependabot[bot]
- chore(deps-dev): bump boto3-stubs from 1.38.29 to 1.38.30 (#6772) by @dependabot[bot]
- chore(deps-dev): bump boto3-stubs from 1.38.28 to 1.38.29 (#6764) by @dependabot[bot]
- chore(deps): bump mkdocstrings-python from 1.16.11 to 1.16.12 (#6765) by @dependabot[bot]
- chore(deps): bump mkdocstrings-python from 1.16.11 to 1.16.12 in /docs (#6768) by @dependabot[bot]
- chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.200.0a0 to 2.200.1a0 (#6766) by @dependabot[bot]
- chore(deps-dev): bump aws-cdk-lib from 2.200.0 to 2.200.1 (#6767) by @dependabot[bot]
This release was made possible by the following contributors:
@dependabot[bot], @github-actions[bot], @leandrodamascena, @matteofigus, dependabot[bot] and github-actions[bot]