Ejemplo n.º 1
0
func main() {

	uaa, err := uaago.NewClient(uaaEndpoint)
	if err != nil {
		fmt.Printf("Error from uaaClient %s\n", err)
		os.Exit(1)
	}

	refresher := tokenRefresher{uaaClient: uaa}

	consumer := consumer.New(dopplerAddress, &tls.Config{InsecureSkipVerify: true}, nil)
	consumer.RefreshTokenFrom(&refresher)
	consumer.SetDebugPrinter(ConsoleDebugPrinter{})

	fmt.Println("===== Streaming metrics")
	msgChan, errorChan := consumer.Firehose(appGuid, "")

	go func() {
		for err := range errorChan {
			fmt.Fprintf(os.Stderr, "%v\n", err.Error())
		}
	}()

	for msg := range msgChan {
		fmt.Printf("%v \n", msg)
	}
}
Ejemplo n.º 2
0
Archivo: main.go Proyecto: Reejoshi/cli
func main() {
	consumer := consumer.New(dopplerAddress, &tls.Config{InsecureSkipVerify: true}, nil)
	consumer.SetDebugPrinter(ConsoleDebugPrinter{})

	fmt.Println("===== Streaming Firehose (will only succeed if you have admin credentials)")

	msgChan, errorChan := consumer.Firehose(firehoseSubscriptionId, authToken)
	go func() {
		for err := range errorChan {
			fmt.Fprintf(os.Stderr, "%v\n", err.Error())
		}
	}()

	for msg := range msgChan {
		fmt.Printf("%v \n", msg)
	}
}