Exemplo n.º 1
0
func main() {
	flag.Parse()

	c, err := mdp.NewClient(*broker, *timeout, *attempts)
	if err != nil {
		panic(err)
	}
	c.Dial()
	defer c.Close()

	var argsAsBytes [][]byte
	for _, v := range flag.Args() {
		argsAsBytes = append(argsAsBytes, []byte(v))
	}
	m := gonzo.CreateMessage(argsAsBytes...)

	reply, err := c.Send(*service, m)
	if err != nil {
		fmt.Println("Error:", err)
		os.Exit(1)
	} else {
		for i, v := range reply {
			fmt.Printf("frame[%02d]: %s\n", i, v)
		}
	}
}
Exemplo n.º 2
0
func CreateWorkerMessage(command byte) gonzo.Message {
	return gonzo.CreateMessage([]byte(""), []byte(WV01), []byte{command})
}
Exemplo n.º 3
0
func echo(request gonzo.Message) (reply gonzo.Message) {
	reply = gonzo.CreateMessage(request...)
	reply = reply.Prepend([]byte("echoing..."))
	return
}