
sarama
A Go library for connecting Go programs to Apache Kafka, MIT-licensed.
- Stars
- 12.5k
- Forks
- 1.9k
- Licence
- MIT
- Language
- Go
- Last update
- 9 days ago
- Type
- Library
What it is
Sarama is an MIT-licensed Go client library for Apache Kafka, a system for passing streams of messages between programs. Developers import it into their Go code to produce and consume Kafka messages. The README points to pkg.go.dev for API documentation, examples, and a mocks subpackage for testing.
- Add a Go producer that publishes events to a Kafka topic
- Build a Go consumer that reads messages from Kafka topics
- Use the mocks subpackage to test code that talks to Kafka without a live broker
- Run the command line tools in the tools directory for testing and diagnostics
Great for
- Go developers who need to send or receive Kafka messages from a Go service
- Teams that want an open-source Kafka client with a documented compatibility policy
- Developers who want test mocks for Kafka-dependent code
Not ideal for
- Non-Go projects, since this is a Go library and the README does not cover other languages
- People who need a managed Kafka service rather than a client library, since Sarama does not run Kafka itself
- Beginners without Go experience, since the README assumes familiarity with Go modules
How to get it
- 1
Install with a package manager
You'll need: Go (version not specified in the README excerpt)
Clone the repository
git clone https://github.com/IBM/sarama - 2
Run it
- Read the API documentation on pkg.go.dev
- Look through the examples directory for a starting program
- Import the library into a Go module and build a small producer or consumer
- Use the mocks subpackage if you want to test without a running Kafka broker
- 3
Get the most out of it
- Use the mocks subpackage to write unit tests without a live Kafka broker
- Browse the examples directory for more complete applications
- Use the tools directory for diagnostics and instrumentation
- Check the FAQ wiki page when you hit common questions
Downloads
Strengths
- MIT license and a public changelog
- Documented compatibility policy: supports the two latest stable Kafka and Go releases, with a two-month grace period
- Follows semantic versioning and standard Go module version numbering
Trade-offs
- The README is truncated and gives no code samples, so setup details must come from pkg.go.dev and the examples directory
- Support is stated only for the two latest Kafka and Go releases, though older Kafka releases are likely to work
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.