Skip to content

bufbuild/bsr-kafka-serde-go

Repository files navigation

The Buf logo

bsr-kafka-serde-go

License CI GoDoc Slack

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 cause Serialize to return an error. Pass WithoutCommitResolution() to opt out and let Bufstream set the header instead. Bufstream also sets this header when configured to use semantic validation.

Usage

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-go

Examples

confluent-kafka-go/v2

See confluent/example/main.go.

franz-go

See franz/example/main.go.

Status: Beta

This module isn't stable yet. However, the final shape is unlikely to change drastically—future edits will be somewhat minor.

Legal

Offered under the Apache 2 license.

About

Kafka serializer and deserializer in Go for working with schemas defined in the Buf Schema Registry.

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors