feat: Add KafkaRecord POJO types for raw Kafka record binding#236
Open
TsuyoshiUshio wants to merge 1 commit intoAzure:devfrom
Open
feat: Add KafkaRecord POJO types for raw Kafka record binding#236TsuyoshiUshio wants to merge 1 commit intoAzure:devfrom
TsuyoshiUshio wants to merge 1 commit intoAzure:devfrom
Conversation
Add types that enable users to bind to raw Apache Kafka records with full metadata access in their function signatures. New files: - KafkaRecord.java — Main POJO with topic, partition, offset, key/value as raw bytes, timestamp, headers, leader epoch + convenience helpers - KafkaHeader.java — Header with key + byte[] value + getValueAsString() - KafkaTimestamp.java — Timestamp with getUnixTimestampMs(), getType(), getDateTimeOffset() - KafkaTimestampType.java — Enum: NotAvailable, CreateTime, LogAppendTime with fromValue() safe mapping Non-breaking: All existing types unchanged. Package: com.microsoft.azure.functions Relates to Azure/azure-functions-kafka-extension#612 Co-authored-by: Dobby <dobby@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
KafkaRecord,KafkaHeader,KafkaTimestamp, andKafkaTimestampTypePOJO types to enable users to bind to raw Apache Kafka records with full metadata access in their function signatures.Issue
Relates to Azure/azure-functions-kafka-extension#612
Relates to Azure/azure-functions-java-worker#868
Changes
KafkaRecord.javabyte[], timestamp, headers, leaderEpoch. IncludesgetKeyAsString()andgetValueAsString()convenience methodsKafkaHeader.javagetValueAsString()helperKafkaTimestamp.javagetUnixTimestampMs(),getType(),getDateTimeOffset()(returnsOffsetDateTime)KafkaTimestampType.javafromValue()safe mappingAll types are in
com.microsoft.azure.functionspackage, consistent with existing Kafka types likeKafkaMessageKeyType,BrokerAuthenticationMode, etc.Breaking Changes
None. All existing types unchanged.
Note
This PR provides the user-facing types. The worker-side Protobuf deserializer (which converts host-sent
ModelBindingDatatoKafkaRecord) is in a separate PR: Azure/azure-functions-java-worker#869.Release order: This library must be released first, then the worker PR can update its dependency version.