Skip to content

Microsoft.Azure.Functions.Worker.Extensions.Kafka 4.2.0

Choose a tag to compare

@TsuyoshiUshio TsuyoshiUshio released this 28 Apr 22:40
89112d8

Microsoft.Azure.Functions.Worker.Extensions.Kafka 4.2.0

New Features

  • KafkaRecord type — Raw Apache Kafka record binding with full metadata access (topic, partition, offset, key/value as raw bytes, headers, timestamp with type, leader epoch) via Protobuf deserialization (#3356)
  • KafkaRecordConverter with [SupportsDeferredBinding] following the EventHubs/ServiceBus pattern (#3356)

Changes

  • Update Microsoft.Azure.WebJobs.Extensions.Kafka dependency from 4.1.4 to 4.3.1 (#3356)
  • Bump VersionPrefix from 4.1.3 to 4.2.0 (#3386)

Usage

dotnet add package Microsoft.Azure.Functions.Worker.Extensions.Kafka --version 4.2.0
[Function("KafkaTrigger")]
public void Run(
    [KafkaTrigger("BrokerList", "my-topic",
     ConsumerGroup = "$Default")] KafkaRecord record)
{
    var topic = record.Topic;
    var partition = record.Partition;
    var offset = record.Offset;
    var key = record.Key;             // byte[] or null
    var value = record.Value;         // byte[]
    var timestamp = record.Timestamp; // UnixTimestampMs + Type (CreateTime/LogAppendTime)
    var headers = record.Headers;     // KafkaHeader[] (key + raw bytes value)
    var leaderEpoch = record.LeaderEpoch; // int? or null
}

PRs Included

  • feat: Add KafkaRecord type and converter for Kafka trigger binding - Phase 2b (#3356)
  • docs: Update Kafka extension release notes for KafkaRecord feature (#3386)

Notes

  • This is a non-breaking, additive change. Existing string, byte[], and KafkaEventData<T> bindings are completely unaffected.
  • KafkaRecord uses Protobuf serialization between the host extension and the worker for efficient binary transport (no Base64 overhead).
  • For the design rationale, see KafkaRecord Design Overview.
  • Relates to Azure/azure-functions-kafka-extension#612.

Full Changelog: kafka-extension-4.1.3...kafka-extension-4.2.0