Exemplo n.º 1
0
// This example demonstrates how to start a new Server.
func ExampleStartServer() {
	server, err := queue.StartServer("127.0.0.1:0")
	if err != nil {
		log.Panicf("Failed to start the server: %s", err)
	}
	defer server.Close()
}
Exemplo n.º 2
0
func (h *MessageHandler) start() error {
	addr, err := config.GetString("queue-server")
	if err != nil {
		return err
	}
	h.server, err = queue.StartServer(addr)
	if err != nil {
		return fmt.Errorf("Could not start queue server at %s: %s", addr, err)
	}
	go h.handleMessages()
	return nil
}