Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
kafka
✓ github.com/segmentio/kafka-go
Read a message from a Kafka topic
package main
import (
"context"
"fmt"
"github.com/segmentio/kafka-go"
)
func main() {
r := kafka.NewReader(kafka.ReaderConfig{
Brokers: []string{"localhost:9092"},
Topic: "my-topic",
})
msg, _ := r.ReadMessage(context.Background())
fmt.Println(string(msg.Value))
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
0.4.47latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.