in polaris/router/go-client/cmd/main.go [55:81]
func main() {
var userProvider = &UserProvider{}
var userProviderWithCustomRegistryGroupAndVersion = &UserProviderWithCustomGroupAndVersion{}
config.SetConsumerService(userProvider)
config.SetConsumerService(userProviderWithCustomRegistryGroupAndVersion)
hessian.RegisterPOJO(&User{})
err := config.Load()
if err != nil {
panic(err)
}
logger.Infof("\n\n\nstart to test dubbo")
uid := os.Getenv("uid")
atta := make(map[string]interface{})
atta["uid"] = uid
reqContext := context.WithValue(context.Background(), constant.DubboCtxKey("attachment"), atta)
for i := 0; i < 5; i++ {
time.Sleep(200 * time.Millisecond)
user, err := userProvider.GetUser(reqContext, &User{Name: "Alex001"})
if err != nil {
panic(err)
}
logger.Infof("response: %v\n", user)
}
}