bsr-kafka-serde-go provides a Kafka serializer and deserializer in Go for working with schemas defined in the Buf Schema Registry. It uses the following Kafka record headers to serialize and deserialize record values from Protobuf:
buf.registry.value.schema.message- The fully-qualified Protobuf message name (e.g.payment.v1alpha1.Order). The serializer always sets this header from the message descriptor. Bufstream also sets this header when configured to use semantic validation.buf.registry.value.schema.commit- The BSR commit ID for the Protobuf message's schema. The serializer sets this automatically by resolving the generated SDK module's pseudo-version against the BSR API. A failed BSR lookup will causeSerializeto return an error. PassWithoutCommitResolution()to opt out and let Bufstream set the header instead. Bufstream also sets this header when configured to use semantic validation.
bsr-kafka-serde-go currently supports confluent-kafka-go/v2 and franz-go,
found in the confluent and franz packages, respectively.
$ go get github.com/bufbuild/bsr-kafka-serde-goSee confluent/example/main.go.
This module isn't stable yet. However, the final shape is unlikely to change drastically—future edits will be somewhat minor.
Offered under the Apache 2 license.