Пример #1
0
func ConnectToZk(zkAddr string, zkSessionTimeout int) (Conn, error) {
	zkConn, _, err := zk.Connect(strings.Split(zkAddr, ","), 3*time.Second, zkSessionTimeout)
	if err != nil {
		return nil, err
	}
	return &MyZkConn{Conn: zkConn}, nil
}
Пример #2
0
func main() {
	c, _, err := zk.Connect([]string{"127.0.0.1"}, time.Second, 30) //*10)
	if err != nil {
		panic(err)
	}
	children, stat, ch, err := c.ChildrenW("/")
	if err != nil {
		panic(err)
	}
	fmt.Printf("%+v %+v\n", children, stat)
	e := <-ch
	fmt.Printf("%+v\n", e)
}