1// 2// MMI echo query example. 3// 4 5package main 6 7import ( 8 "github.com/pebbe/zmq4/examples/mdapi" 9 10 "fmt" 11 "os" 12) 13 14func main() { 15 var verbose bool 16 if len(os.Args) > 1 && os.Args[1] == "-v" { 17 verbose = true 18 } 19 session, _ := mdapi.NewMdcli("tcp://localhost:5555", verbose) 20 21 // This is the service we want to look up 22 request := "echo" 23 24 // This is the service we send our request to 25 reply, err := session.Send("mmi.service", request) 26 27 if err == nil { 28 fmt.Println("Lookup echo service:", reply[0]) 29 } else { 30 fmt.Println("E: no response from broker, make sure it's running") 31 } 32} 33