confluent-kafka-go

Confluent's official Go client for Apache Kafka, built on librdkafka for production-grade performance and reliability.

SDK
Go
vv2.15.0
5,159stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
93/100Excellent
Development Activity96
Maintenance84
Community92
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture85
Code Quality85
Innovation78
Learning Curve65

confluent-kafka-go is Confluent’s official Golang client for Apache Kafka, providing high-level Producer and Consumer APIs backed by librdkafka, the battle-tested C library that also powers Confluent’s Python and .NET clients. It bundles prebuilt librdkafka binaries for macOS, glibc and musl Linux, and Windows, so most applications get Kafka connectivity without a separate C toolchain.

Beyond core producer/consumer functionality, the library ships an Admin API for topic and ACL management, a mock cluster for local integration testing without a running broker, and a Schema Registry client with Avro, Protobuf, and JSON Schema serializers/deserializers — including client-side field-level encryption and a FIPS 140-3 compliant mode for Schema Registry TLS communication.

What You Get

  • High-level Producer and Consumer APIs backed by librdkafka’s C implementation for near-native performance
  • Prebuilt, statically-linked librdkafka binaries for macOS, glibc/musl Linux, and Windows — no separate C toolchain required
  • An Admin API for managing topics, ACLs, consumer groups, and cluster configuration
  • A Schema Registry client with Avro, Protobuf, and JSON Schema serializers, including client-side field-level encryption
  • A mock cluster for integration testing without a live Kafka broker

Common Use Cases

  • Building event-driven microservices that produce and consume Kafka topics in Go
  • Streaming data pipelines that need Confluent Cloud or Confluent Platform connectivity
  • Applications requiring Schema Registry-backed Avro/Protobuf message validation
  • Administrative tooling for managing Kafka topics, ACLs, and consumer group offsets

Under The Hood

Architecture The library is a cgo wrapper: the kafka package binds directly to librdkafka through import "C", with glue code in glue_rdkafka.h/select_rdkafka.h converting between Go and C representations of messages, headers, and topic-partition lists. A shared Handle interface (handle.go) unifies state common to Producer and Consumer, including OAuth/SASL token refresh. The Producer exposes a non-blocking, event-driven Produce() with delivery reports on a channel, while the Consumer follows librdkafka’s native poll model via Poll(). Platform-specific build-tag files (build_darwin_amd64.go, build_glibc_linux_amd64.go, build_musl_linux_arm64.go, build_windows.go, build_dynamic.go) select static vs. dynamic librdkafka linking at compile time, giving zero-config cross-platform builds. The Schema Registry client lives in a fully separate schemaregistry/ package with its own REST client, serde codecs, and rules engine, so it can be adopted independently of the core Kafka client.

Tech Stack Go 1.25+ with cgo bindings to bundled, prebuilt librdkafka static binaries. Schema Registry support pulls in Avro codecs (hamba/avro, gogen-avro, Confluent’s own avro-go fork), Protobuf tooling (google.golang.org/protobuf, jhump/protoreflect), JSON Schema validation (santhosh-tekuri/jsonschema, invopop/jsonschema), and CEL (google/cel-go) for schema migration rules. Client-side field-level encryption is built on Google’s Tink library with pluggable KMS backends for AWS KMS, Azure Key Vault, and HashiCorp Vault, backed by the respective AWS SDK v2, Azure SDK for Go, and Vault API clients. CI runs on Semaphore across macOS/Linux (glibc, musl) and Windows, exercising both static and dynamic librdkafka linking.

Code Quality Over 40 _test.go files span the kafka and schemaregistry packages, combining unit tests, benchmark tests (go test -bench), and integration tests that run against a real Kafka cluster (testconf.json). Errors from librdkafka are surfaced through a dedicated Error type carrying retriable/fatal/txnRequiresAbort flags, with error codes auto-generated from librdkafka via go generate. Contributor docs require gofmt, go vet, and golint before merging, and every source file carries Apache License headers plus exported Go doc comments.

API Design The API favors idiomatic Go patterns — ConfigMap-based configuration, a poll-based Consumer, and a non-blocking async Producer — that map cleanly onto librdkafka’s native model rather than reinventing Kafka’s wire protocol in pure Go, giving it day-one parity with Confluent’s Python/.NET/C++ clients for features like transactions, exactly-once semantics, and OAuth/SASL. The tradeoff is that cgo linking (-tags musl, -tags dynamic) leaks into consumers’ build configuration. Distinctive additions beyond a typical Kafka client are the FIPS 140-3 compliant mode for Schema Registry TLS and a Schema Registry serde layer with cloud-KMS-backed field-level encryption, both uncommon in general-purpose Kafka client libraries.

Used by 5 apps in this directory

TypeScript
57%
MIT

Jitsu

Data Engineering

5,063

Open-source, fully-scriptable data ingestion engine that streams events from web, apps, and APIs to any data warehouse in real time.

View details
88
Repo Health
79
Technical
66
Dependency
Built with
TypeScript57%
Go41%
Updated 3 days ago
Go
78%
Apache 2.0

OpenMeter

Invoicing Finance · Developer Tools

2,247

Open-source metering and billing engine for AI, agentic, and DevTool monetization — ingest usage events in real time and turn them into accurate invoices automatically.

View details
87
Repo Health
81
Technical
66
Dependency
Built with
Go78%
TypeScript17%
Updated yesterday
TypeScript
55%
Other

OpenReplay

Analytics

12,751

Self-hosted session replay and product analytics suite that lets you see exactly what users do on your web app — without sending data to third parties.

View details
90
Repo Health
77
Technical
66
Dependency
Built with
TypeScript55%
Go12%
Python10%
Updated 3 days ago
Python
54%
Other

PostHog

Analytics · Monitoring · Developer Tools

39,612

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python54%
TypeScript36%
Updated today
Go
40%
Apache 2.0

Rill

Analytics · Data Engineering

2,867

The fastest BI tool for humans and agents — define metrics, models, and dashboards as code and query them instantly on ClickHouse or DuckDB.

View details
87
Repo Health
88
Technical
64
Dependency
Built with
Go40%
TypeScript37%
Svelte22%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search