package
module
Version:
v0.0.0-...-cc4b76c
Opens a new window with list of versions in this module.
Published: Jan 13, 2017
License: MIT
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 3
Opens a new window with list of known importers.
README
¶
kafka-brokers-go
Go library to access Kafka broker list in Zookeeper. It's useful when working with sarama.
Usage
package main
import (
"fmt"
"github.com/philipjkim/kafka-brokers-go"
)
func main() {
zkServers := []string{"192.168.99.100:2181"}
c, err := kb.NewConn(zkServers)
if err != nil {
panic(err)
}
defer c.Close()
for {
brokers, ch, err := c.GetW()
if err != nil {
panic(err)
}
fmt.Printf("%q\n", brokers)
e := <-ch
fmt.Printf("%v\n", e.Type)
}
}
References
Documentation
¶
Conn interacts with the Kafka metadata in Zookeeper.
NewConn creates a new connection instance.
Close closes the connection with the Zookeeper.
GetW returns a list of all Kafka brokers, and a channel for watching changes.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.