Exemplo n.º 1
0
func main() {
	// register "isprime" as service
	fmt.Println("running...")
	var err error = service.RunService(&serviceIsPrime, isprimeHandler)
	if err != nil {
		fmt.Println("Error occured: ")
		fmt.Println(err)
	}
}
func main() {
	// register "concatenate" as service
	fmt.Println("running...")
	err := service.RunService(&serviceConcatenate, concatenateHandler)
	if err != nil {
		fmt.Println("Error occured: ")
		fmt.Println(err)
	}
}
Exemplo n.º 3
0
func main() {
	rand.Seed(time.Now().Unix())

	// register "random" as service
	fmt.Println("running...")
	var err error = service.RunService(&serviceRandom, randomHandler)
	if err != nil {
		fmt.Println("Error occured: ")
		fmt.Println(err)
	}
}
// Create composite service service1(service2()) as servicenew
func createCompositeService(service1, service2, servicenew string) {
	desc := service1 + "(" + service2 + "())."
	serviceInfo := service.ServiceInfo{
		servicenew,
		"string",
		desc,
		[]service.ArgumentInfo{
			{"void", "void", "void"},
		},
	}

	service.RunService(&serviceInfo, func(servicecall *service.ServiceCall) string {
		result, _ := service.CallService(service2)
		result, _ = service.CallService(service1, result)
		return result
	})
}