Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: tag route static config #2304

Merged
merged 13 commits into from
May 30, 2023
Prev Previous commit
Next Next commit
use strings.Join
  • Loading branch information
wudong5 committed Apr 19, 2023
commit 1aacccdf85bf50d20a7bebdf53f3a7039baac571
4 changes: 2 additions & 2 deletions cluster/router/tag/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (p *PriorityRouter) Route(invokers []protocol.Invoker, url *common.URL, inv
return invokers
}
// tag is valid in application
key := url.GetParam(constant.ApplicationKey, "") + constant.TagRouterRuleSuffix
key := strings.Join([]string{url.GetParam(constant.ApplicationKey, ""), constant.TagRouterRuleSuffix}, "")
value, ok := p.routerConfigs.Load(key)
if !ok {
return staticTag(invokers, url, invocation)
Expand Down Expand Up @@ -87,7 +87,7 @@ func (p *PriorityRouter) Notify(invokers []protocol.Invoker) {
logger.Warnf("config center does not start, please check if the configuration center has been properly configured in dubbogo.yml")
return
}
key := service + constant.TagRouterRuleSuffix
key := strings.Join([]string{service, constant.TagRouterRuleSuffix}, "")
dynamicConfiguration.AddListener(key, p)
value, err := dynamicConfiguration.GetRule(key)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion config_center/zookeeper/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func newZookeeperDynamicConfiguration(url *common.URL) (*zookeeperDynamicConfigu
// AddListener add listener for key
// TODO this method should has a parameter 'group', and it does not now, so we should concat group and key with '/' manually
func (c *zookeeperDynamicConfiguration) AddListener(key string, listener config_center.ConfigurationListener, options ...config_center.Option) {
key = c.GetURL().GetParam(constant.ConfigNamespaceKey, config_center.DefaultGroup) + "/" + key
key = strings.Join([]string{c.GetURL().GetParam(constant.ConfigNamespaceKey, config_center.DefaultGroup), key}, "/")
qualifiedKey := buildPath(c.rootPath, key)
c.cacheListener.AddListener(qualifiedKey, listener)
}
Expand Down