You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/07/01 04:42:09 UTC

[GitHub] [incubator-shenyu-client-golang] stulzq opened a new issue, #20: 无法成功注册

stulzq opened a new issue, #20:
URL: https://github.com/apache/incubator-shenyu-client-golang/issues/20

   我在本地运行的 ShenYu Admin & BootstrapApplication,然后运行了 .NET client 可以成功注册
   
   ![image](https://user-images.githubusercontent.com/13200155/176824295-0e1e7ec8-6365-4298-ab02-96d4a454544e.png)
   
   我直接使用的 go client 仓库的 http client example
   
   ````go
   /*
    * Licensed to the Apache Software Foundation (ASF) under one or more
    * contributor license agreements.  See the NOTICE file distributed with
    * this work for additional information regarding copyright ownership.
    * The ASF licenses this file to You under the Apache License, Version 2.0
    * (the "License"); you may not use this file except in compliance with
    * the License.  You may obtain a copy of the License at
    *
    *     http://www.apache.org/licenses/LICENSE-2.0
    *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
   
   package main
   
   import (
   	"github.com/apache/incubator-shenyu-client-golang/clients"
   	"github.com/apache/incubator-shenyu-client-golang/common/constants"
   	"github.com/apache/incubator-shenyu-client-golang/model"
   	"github.com/wonderivan/logger"
   )
   
   /**
    * The shenyu_http_client example
    **/
   func main() {
   
   	//init ShenYuAdminClient
   	adminClient := &model.ShenYuAdminClient{
   		UserName: "admin",  //user provide
   		Password: "123456", //user provide
   	}
   
   	adminToken, err := clients.NewShenYuAdminClient(adminClient)
   	if err == nil {
   		logger.Info("this is ShenYu Admin client token ->", adminToken.AdminTokenData.Token)
   	}
   
   	//init MetaDataRegister
   	metaData := &model.MetaDataRegister{
   		AppName: "test",      //require user provide
   		Path:    "/test/aaa", //require user provide
   		Enabled: true,        //require user provide
   		Host:    "127.0.0.1", //require user provide
   		Port:    "5000",      //require user provide
   	}
   	result, err := clients.RegisterMetaData(adminToken.AdminTokenData, metaData)
   	if err != nil {
   		logger.Warn("MetaDataRegister has error:", err)
   	}
   	logger.Info("finish register metadata ,the result is->", result)
   
   	//init urlRegister
   	urlRegister := &model.URIRegister{
   		Protocol:    "http://",              //require user provide
   		AppName:     "test",                 //require user provide
   		ContextPath: "/test/aaa",            //require user provide
   		RPCType:     constants.RPCTYPE_HTTP, //require user provide
   		Host:        "127.0.0.1",            //require user provide
   		Port:        "5000",                 //require user provide
   	}
   	result, err = clients.UrlRegister(adminToken.AdminTokenData, urlRegister)
   	if err != nil {
   		logger.Warn("UrlRegister has error:", err)
   	}
   	logger.Info("finish UrlRegister ,the result is->", result)
   
   	//do you logic
   }
   
   ````
   
   客户端日志看起来是 ok 的
   
   ````
   2022-07-01 12:38:50 [INFO] [/Users/lzq/OpenSource/shenyu/incubator-shenyu-client-golang/clients/admin_client/shenyu_admin_client.go:51] Get ShenYu Admin response, body is -> {200 login dashboard user success {1 admin 1 true 2022-05-25 18:02:52 2022-05-25 18:02:52 eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjU2NzM2NzMwfQ.JAL9NDC-sCcrfnaIICosOScRAORXGpIKhNUsyLc07O0}}
   2022-07-01 12:38:50 [INFO] [/Users/lzq/OpenSource/shenyu/incubator-shenyu-client-golang/example/http_client/main.go:40] this is ShenYu Admin client token -> eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjU2NzM2NzMwfQ.JAL9NDC-sCcrfnaIICosOScRAORXGpIKhNUsyLc07O0
   2022-07-01 12:38:50 [INFO] [/Users/lzq/OpenSource/shenyu/incubator-shenyu-client-golang/example/http_client/main.go:55] finish register metadata ,the result is-> true
   2022-07-01 12:38:50 [INFO] [/Users/lzq/OpenSource/shenyu/incubator-shenyu-client-golang/example/http_client/main.go:70] finish UrlRegister ,the result is-> true
   ````
   
   但是 Admin 无法查询到注册信息,没有成功注册。
   
   并且 admin 一直在报错 
   
   ````
   2022-07-01 12:41:00 [shenyu-shared_wheel_timer-3] WARN  org.apache.shenyu.common.timer.AbstractRetryTask - Failed to execute task:/test/aaa:divide,retried:26 ,total retries:-1,cause:doRegister Failed to execute,wait to retry.
   ```
   
   .NET client 注册并不会触发 admin 报错,Go client 只要运行了注册就会有这个。
   
   如何才能成功注册呢


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu-client-golang] stulzq commented on issue #20: 无法成功注册

Posted by GitBox <gi...@apache.org>.
stulzq commented on issue #20:
URL: https://github.com/apache/incubator-shenyu-client-golang/issues/20#issuecomment-1171991773

   > Okay,I will handle it.
   
   I solved it, will submit a PR later


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu-client-golang] yu199195 closed issue #20: Can not register

Posted by GitBox <gi...@apache.org>.
yu199195 closed issue #20: Can not register
URL: https://github.com/apache/incubator-shenyu-client-golang/issues/20


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-shenyu-client-golang] lishuo5263 commented on issue #20: 无法成功注册

Posted by GitBox <gi...@apache.org>.
lishuo5263 commented on issue #20:
URL: https://github.com/apache/incubator-shenyu-client-golang/issues/20#issuecomment-1171940406

   Okay,I will handle it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org