Exemple #1
0
func main() {
	shared.LoadEnvironment()

	requester := request.NewRequester(createDesmondConnection("METRICS_PUBLISHER"))

	for {
		time.Sleep(time.Millisecond * 5)
		var res shared.Payload
		err := requester.Request(request.CreateMetricA, shared.NewPayload(), &res)
		if err != nil {
			panic(err)
		}
	}

	ch := make(chan os.Signal)
	signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
	<-ch

	println("Shutting down...")
	return

}
Exemple #2
0
func main() {
	shared.LoadEnvironment()

	requester := request.NewRequester(createDesmondConnection("METRICS_SUBSCRIBER"))

	requester.Handle(request.CreateMetricA.Request(), func(c *request.RequestContext) {
		var req shared.Payload
		err := c.Bind(&req)
		if err != nil {
			panic(err)
		}

		c.Respond(req)
	})

	ch := make(chan os.Signal)
	signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
	<-ch

	println("Shutting down...")
	return

}