AlexStocks commented on code in PR #1059:
URL: https://github.com/apache/dubbo-go-samples/pull/1059#discussion_r2990635836


##########
router/static_config/tag/go-client/cmd/client.go:
##########
@@ -0,0 +1,98 @@
+/*
+ * 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 (
+       "context"
+       "os"
+       "strings"
+)
+
+import (
+       "dubbo.apache.org/dubbo-go/v3"
+       "dubbo.apache.org/dubbo-go/v3/client"
+       "dubbo.apache.org/dubbo-go/v3/cluster/router"
+       "dubbo.apache.org/dubbo-go/v3/common/constant"
+       "dubbo.apache.org/dubbo-go/v3/global"
+       _ "dubbo.apache.org/dubbo-go/v3/imports"
+
+       "github.com/dubbogo/gost/log/logger"
+)
+
+import (
+       greet "github.com/apache/dubbo-go-samples/direct/proto"
+)
+
+const (
+       clientApplication = "static-tag-client"
+       tagName           = "gray"
+       grayAddress       = "127.0.0.1:20002"
+       directURL         = 
"tri://127.0.0.1:20000;tri://127.0.0.1:20002?dubbo.tag=gray"
+       expectedServer    = "server-with-gray-tag"
+)
+
+func main() {
+       ins, err := dubbo.NewInstance(
+               dubbo.WithName(clientApplication),
+               dubbo.WithRouter(
+                       router.WithScope("application"),
+                       router.WithKey(clientApplication),

Review Comment:
   [P1] 这里把 application-scope 静态 tag 路由的 `key` 设成了 consumer 自己的应用名,但上游当前 
`PriorityRouter.Route()` 是按 provider URL 上的 application 去取路由 
key。结果就是样例虽然能编译,实际运行时大概率查不到这条静态 tag 规则,`gray` 请求不会按预期落到 20002。建议把 key 改成 
provider application,或者等上游把 application-scope 静态 tag 的 key 语义统一后再同步样例。



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to