Пример #1
0
func main() {
	// Create the first service
	floatSvc := new(math.FloatService)
	floatSvc.SvcObj = new(impl.FloatServiceImpl)

	// Create request
	req := new(math.FloatServiceAddRequest)
	req.Init()
	A := 3.4
	B := 6.2
	req.A = &A
	req.B = &B

	// Create response
	rsp := new(math.FloatServiceAddResponse)
	rsp.Init()

	// Add
	err := floatSvc.Add(req, rsp)
	if err != nil {
		fmt.Printf("Oops, error: %s\n", err)
	} else {
		fmt.Printf("Value = %f\n", *rsp.Value)
	}
}
Пример #2
0
func main() {

	// Register the first service
	floatSvc := new(math.FloatService)
	floatSvc.SvcObj = new(impl.FloatServiceImpl)
	babel.Register(floatSvc)

	// Register the second service
	fractSvc := new(math.FractionService)
	fractSvc.SvcObj = new(impl.FractionServiceImpl)
	babel.Register(fractSvc)

	// Set some info for the monitoring page
	kubismus.Setup("Math Service", "")
	kubismus.Note("Babel base path", "http://localhost:9999"+babel.DefaultHttpPath)
	kubismus.Note("Monitoring path", "http://localhost:9999"+kubismus.DefaultPath)
	kubismus.Note("Test harness path", "http://localhost:9999/test/")
	kubismus.Define("Requests", kubismus.COUNT, "Requests/sec")

	// Set up Babel HTTP handlers and serve HTTP
	http.Handle(babel.DefaultHttpPath, kubismus.HttpRequestMetric("Requests", babel.DefaultServer))
	kubismus.HandleHTTP()
	http.HandleFunc("/test/", harness.ServeHTTP)
	http.HandleFunc("/", frame)
	log.Fatal(http.ListenAndServe(":9999", nil))
}
Пример #3
0
func main() {
	// Register the first service
	floatSvc := new(math.FloatService)
	floatSvc.SvcObj = new(impl.FloatServiceImpl)
	babel.Register(floatSvc)

	// Register the second service
	fractSvc := new(math.FractionService)
	fractSvc.SvcObj = new(impl.FractionServiceImpl)
	babel.Register(fractSvc)

	// Set up Babel HTTP handlers and serve HTTP
	babel.HandleHTTP()
	log.Fatal(http.ListenAndServe(":9999", nil))
}