diff --git a/README.md b/README.md index d97918d095..bb92459f1d 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Dubbo-go has supported many RPC protocol, like Triple, Dubbo JSONRPC, gRPC, HTTP ![](https://dubbogo.github.io/img/devops.png) - **Registry**: Nacos, Zookeeper, ETCD, Polaris-mesh, Consul. -- **ConfigCenter**: Nacos, Apollo, Zookeeper +- **ConfigCenter**: Nacos, Zookeeper - **Cluster Strategy**: Failover, [Failfast](https://github.com/apache/dubbo-go/pull/140), [Failsafe/Failback](https://github.com/apache/dubbo-go/pull/136), [Available](https://github.com/apache/dubbo-go/pull/155), [Broadcast](https://github.com/apache/dubbo-go/pull/158), [Forking](https://github.com/apache/dubbo-go/pull/161) - **Load Balance**: [AdaptiveService](https://github.com/apache/dubbo-go/pull/1649), Random, [RoundRobin](https://github.com/apache/dubbo-go/pull/66), [LeastActive](https://github.com/apache/dubbo-go/pull/65), [ConsistentHash](https://github.com/apache/dubbo-go/pull/261) - [**Filter**](./filter): Echo, Hystrix, Token, AccessLog, TpsLimiter, ExecuteLimit, Generic, Auth/Sign, Metrics, Tracing, Active, Seata, Sentinel diff --git a/README_CN.md b/README_CN.md index a87921bf16..217e5e4da0 100644 --- a/README_CN.md +++ b/README_CN.md @@ -32,7 +32,7 @@ Dubbo-go 生态覆盖多种网络协议:Triple、Dubbo、JSONRPC、gRPC、HTTP - **配置中心** - 开发者可以使用Nacos、Apollo(携程开源)、Zookeeper 进行框架/用户的配置的发布和拉取。 + 开发者可以使用Nacos、Zookeeper 进行框架/用户的配置的发布和拉取。 - **集群策略**: Failover, [Failfast](https://github.com/apache/dubbo-go/pull/140), [Failsafe/Failback](https://github.com/apache/dubbo-go/pull/136), [Available](https://github.com/apache/dubbo-go/pull/155), [Broadcast](https://github.com/apache/dubbo-go/pull/158), [Forking](https://github.com/apache/dubbo-go/pull/161) 等 diff --git a/config/config_center_config_test.go b/config/config_center_config_test.go deleted file mode 100644 index b32c4c5da8..0000000000 --- a/config/config_center_config_test.go +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 config - -import ( - "testing" -) - -import ( - "github.com/stretchr/testify/assert" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/constant" - _ "dubbo.apache.org/dubbo-go/v3/config_center/apollo" -) - -func TestApolloConfigCenterConfig(t *testing.T) { - - err := Load(WithPath("./testdata/config/center/apollo.yaml")) - assert.Nil(t, err) - - registries := rootConfig.Registries - assert.NotNil(t, registries) -} -func TestConfigCenterConfig(t *testing.T) { - var ( - config *CenterConfig - err error - ) - - t.Run("ConfigCenterConfigBuilder", func(t *testing.T) { - config = NewConfigCenterConfigBuilder(). - SetProtocol("protocol"). - SetUserName("userName"). - SetAddress("address"). - SetPassword("password"). - SetNamespace("namespace"). - SetGroup("group"). - SetDataID("dataId"). - Build() - - err = config.check() - assert.Nil(t, err) - - assert.Equal(t, config.Protocol, "protocol") - assert.Equal(t, config.Username, "userName") - assert.Equal(t, config.Address, "address") - assert.Equal(t, config.Password, "password") - assert.Equal(t, config.Namespace, "namespace") - assert.Equal(t, config.Group, "group") - assert.Equal(t, config.DataId, "dataId") - assert.Equal(t, config.Prefix(), constant.ConfigCenterPrefix) - //assert.Equal(t, config.NameId(), - // strings.Join([]string{constant.ConfigCenterPrefix, "protocol", "address"}, "-")) - }) - - t.Run("GetUrlMap", func(t *testing.T) { - url := config.GetUrlMap() - assert.Equal(t, url.Get(constant.ConfigNamespaceKey), config.Namespace) - assert.Equal(t, url.Get(constant.ConfigClusterKey), config.Cluster) - }) - - t.Run("translateConfigAddress", func(t *testing.T) { - address := config.translateConfigAddress() - assert.Equal(t, address, "address") - }) - - t.Run("toUrl", func(t *testing.T) { - url, err := config.toURL() - assert.Nil(t, err) - namespace := url.GetParam(constant.ConfigNamespaceKey, "namespace") - assert.Equal(t, namespace, "namespace") - }) -} diff --git a/config/testdata/config/center/apollo.yaml b/config/testdata/config/center/apollo.yaml deleted file mode 100644 index 0b10e9e793..0000000000 --- a/config/testdata/config/center/apollo.yaml +++ /dev/null @@ -1,8 +0,0 @@ -dubbo: - config-center: - address: apollo://106.54.227.205:8080 - cluster: dev - namespace: dubbogo.yaml - app-id: dubbo-go - params: - secret: 3a64cf5cd9ac4fcd94eb045de433689c \ No newline at end of file diff --git a/config/testdata/consumer_config_with_configcenter_apollo.yml b/config/testdata/consumer_config_with_configcenter_apollo.yml deleted file mode 100644 index 71a8b8c9df..0000000000 --- a/config/testdata/consumer_config_with_configcenter_apollo.yml +++ /dev/null @@ -1,24 +0,0 @@ -# use apollo config center for fetch config file -# default config file namespace is dubbo.properties -# consumer config file Ref:consumer_config.properties -# provider config file Ref:provider_config.properties -config_center: - protocol: apollo - address: 106.12.25.204:8080 - group: testApplication_yang - cluster: dev - # 'namespace' can be used for router rule , default value is dubbo.properties - # but if you want to change router rule config file ,just open this item -# namespace: governance.properties - # 'config_file' is not necessary ,default : dubbo.properties - # but if you want to change config file ,just open this item -# config_file: mockDubbog.properties - -# application config required -application: - organization: "ikurento.com" - name: "BDTService" - module: "dubbogo user-info server" - version: "0.0.1" - owner: "ZX" - environment: "dev" \ No newline at end of file diff --git a/config_center/apollo/doc.go b/config_center/apollo/doc.go deleted file mode 100644 index a94ed5f448..0000000000 --- a/config_center/apollo/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 apollo implements config center around Apollo. -package apollo diff --git a/config_center/apollo/factory.go b/config_center/apollo/factory.go deleted file mode 100644 index 536c22feb3..0000000000 --- a/config_center/apollo/factory.go +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 apollo - -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/extension" - "dubbo.apache.org/dubbo-go/v3/config_center" - "dubbo.apache.org/dubbo-go/v3/config_center/parser" -) - -func init() { - extension.SetConfigCenterFactory("apollo", createDynamicConfigurationFactory) -} - -func createDynamicConfigurationFactory() config_center.DynamicConfigurationFactory { - return &apolloConfigurationFactory{} -} - -type apolloConfigurationFactory struct{} - -// GetDynamicConfiguration gets the dynamic configuration -func (f *apolloConfigurationFactory) GetDynamicConfiguration(url *common.URL) (config_center.DynamicConfiguration, error) { - dynamicConfiguration, err := newApolloConfiguration(url) - if err != nil { - return nil, err - } - dynamicConfiguration.SetParser(&parser.DefaultConfigurationParser{}) - return dynamicConfiguration, err -} diff --git a/config_center/apollo/impl.go b/config_center/apollo/impl.go deleted file mode 100644 index f6f64e47ea..0000000000 --- a/config_center/apollo/impl.go +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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 apollo - -import ( - "fmt" - "regexp" - "strings" - "sync" -) - -import ( - gxset "github.com/dubbogo/gost/container/set" - - perrors "github.com/pkg/errors" - - "github.com/zouyx/agollo/v3" - "github.com/zouyx/agollo/v3/env/config" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/common/constant" - "dubbo.apache.org/dubbo-go/v3/common/logger" - cc "dubbo.apache.org/dubbo-go/v3/config_center" - "dubbo.apache.org/dubbo-go/v3/config_center/parser" -) - -const ( - apolloProtocolPrefix = "http://" -) - -type apolloConfiguration struct { - cc.BaseDynamicConfiguration - url *common.URL - - listeners sync.Map - appConf *config.AppConfig - parser parser.ConfigurationParser -} - -func newApolloConfiguration(url *common.URL) (*apolloConfiguration, error) { - c := &apolloConfiguration{ - url: url, - } - c.appConf = &config.AppConfig{ - AppID: url.GetParam(constant.ConfigAppIDKey, ""), - Cluster: url.GetParam(constant.ConfigClusterKey, ""), - NamespaceName: url.GetParam(constant.ConfigNamespaceKey, cc.DefaultGroup), - IP: c.getAddressWithProtocolPrefix(url), - Secret: url.GetParam(constant.ConfigSecretKey, ""), - IsBackupConfig: url.GetParamBool(constant.ConfigBackupConfigKey, true), - BackupConfigPath: url.GetParam(constant.ConfigBackupConfigPathKey, ""), - } - logger.Infof("[Apollo ConfigCenter] New Apollo ConfigCenter with Configuration: %+v, url = %+v", c.appConf, c.url) - agollo.InitCustomConfig(func() (*config.AppConfig, error) { - return c.appConf, nil - }) - return c, agollo.Start() -} - -func (c *apolloConfiguration) AddListener(key string, listener cc.ConfigurationListener, opts ...cc.Option) { - k := &cc.Options{} - for _, opt := range opts { - opt(k) - } - - key = k.Group + key - l, _ := c.listeners.LoadOrStore(key, newApolloListener()) - l.(*apolloListener).AddListener(listener) -} - -func (c *apolloConfiguration) RemoveListener(key string, listener cc.ConfigurationListener, opts ...cc.Option) { - k := &cc.Options{} - for _, opt := range opts { - opt(k) - } - - key = k.Group + key - l, ok := c.listeners.Load(key) - if ok { - l.(*apolloListener).RemoveListener(listener) - } -} - -func (c *apolloConfiguration) GetInternalProperty(key string, opts ...cc.Option) (string, error) { - newConfig := agollo.GetConfig(c.appConf.NamespaceName) - if newConfig == nil { - return "", perrors.New(fmt.Sprintf("nothing in namespace:%s ", key)) - } - return newConfig.GetStringValue(key, ""), nil -} - -func (c *apolloConfiguration) GetRule(key string, opts ...cc.Option) (string, error) { - return c.GetInternalProperty(key, opts...) -} - -// PublishConfig will publish the config with the (key, group, value) pair -func (c *apolloConfiguration) PublishConfig(string, string, string) error { - return perrors.New("unsupport operation") -} - -// GetConfigKeysByGroup will return all keys with the group -func (c *apolloConfiguration) GetConfigKeysByGroup(group string) (*gxset.HashSet, error) { - return nil, perrors.New("unsupport operation") -} - -func (c *apolloConfiguration) GetProperties(key string, opts ...cc.Option) (string, error) { - /** - * when group is not null, we are getting startup configs(config file) from ShutdownConfig Center, for example: - * key=dubbo.propertie - */ - if key == "" { - key = c.appConf.NamespaceName - } - tmpConfig := agollo.GetConfig(key) - if tmpConfig == nil { - return "", perrors.New(fmt.Sprintf("nothing in namespace:%s ", key)) - } - - content := tmpConfig.GetContent() - b := []byte(content) - if len(b) == 0 { - return "", perrors.New(fmt.Sprintf("nothing in namespace:%s ", key)) - } - - content = string(b[8:]) //remove defalut content= prefix - return content, nil -} - -func (c *apolloConfiguration) getAddressWithProtocolPrefix(url *common.URL) string { - address := url.Location - converted := address - if len(address) != 0 { - addr := regexp.MustCompile(`\s+`).ReplaceAllString(address, "") - parts := strings.Split(addr, ",") - addrs := make([]string, 0) - for _, part := range parts { - addr := part - if !strings.HasPrefix(part, apolloProtocolPrefix) { - addr = apolloProtocolPrefix + part - } - addrs = append(addrs, addr) - } - converted = strings.Join(addrs, ",") - } - return converted -} - -func (c *apolloConfiguration) Parser() parser.ConfigurationParser { - return c.parser -} - -func (c *apolloConfiguration) SetParser(p parser.ConfigurationParser) { - c.parser = p -} diff --git a/config_center/apollo/impl_test.go b/config_center/apollo/impl_test.go deleted file mode 100644 index 70b03af114..0000000000 --- a/config_center/apollo/impl_test.go +++ /dev/null @@ -1,216 +0,0 @@ -/* - * 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 apollo - -import ( - "encoding/json" - "fmt" - "net/http" - "net/http/httptest" - "strings" - "sync" - "testing" -) - -import ( - "github.com/knadh/koanf" - "github.com/knadh/koanf/parsers/yaml" - "github.com/knadh/koanf/providers/rawbytes" - - "github.com/stretchr/testify/assert" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common" - "dubbo.apache.org/dubbo-go/v3/config" - "dubbo.apache.org/dubbo-go/v3/config_center" - "dubbo.apache.org/dubbo-go/v3/config_center/parser" - "dubbo.apache.org/dubbo-go/v3/remoting" -) - -const ( - mockAppId = "testApplication_yang" - mockCluster = "dev" - mockNamespace = "mockDubbogo.yaml" - mockNotifyRes = `[{ - "namespaceName": "mockDubbogo.yaml", - "notificationId": 53050, - "messages": { - "details": { - "testApplication_yang+default+mockDubbogo": 53050 - } - } -}]` - mockServiceConfigRes = `[{ - "appName": "APOLLO-CONFIGSERVICE", - "instanceId": "instance-300408ep:apollo-configservice:8080", - "homepageUrl": "http://localhost:8080" -}]` -) - -var mockConfigRes = `{ - "appId": "testApplication_yang", - "cluster": "default", - "namespaceName": "mockDubbogo.yaml", - "configurations":{ - "content":"dubbo:\n application:\n name: \"demo-server\"\n version: \"2.0\"\n" - }, - "releaseKey": "20191104105242-0f13805d89f834a4" -}` - -func initApollo() *httptest.Server { - handlerMap := make(map[string]func(http.ResponseWriter, *http.Request), 1) - handlerMap[mockNamespace] = configResponse - - return runMockConfigServer(handlerMap, notifyResponse) -} - -func configResponse(rw http.ResponseWriter, _ *http.Request) { - result := mockConfigRes - fmt.Fprintf(rw, "%s", result) -} - -func notifyResponse(rw http.ResponseWriter, req *http.Request) { - result := mockNotifyRes - fmt.Fprintf(rw, "%s", result) -} - -func serviceConfigResponse(rw http.ResponseWriter, _ *http.Request) { - result := mockServiceConfigRes - fmt.Fprintf(rw, "%s", result) -} - -// run mock config server -func runMockConfigServer(handlerMap map[string]func(http.ResponseWriter, *http.Request), - notifyHandler func(http.ResponseWriter, *http.Request)) *httptest.Server { - uriHandlerMap := make(map[string]func(http.ResponseWriter, *http.Request)) - for namespace, handler := range handlerMap { - uri := fmt.Sprintf("/configs/%s/%s/%s", mockAppId, mockCluster, namespace) - uriHandlerMap[uri] = handler - } - uriHandlerMap["/notifications/v2"] = notifyHandler - uriHandlerMap["/services/config"] = serviceConfigResponse - - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - uri := r.RequestURI - for path, handler := range uriHandlerMap { - if strings.HasPrefix(uri, path) { - handler(w, r) - break - } - } - })) - - return ts -} - -func TestGetConfig(t *testing.T) { - configuration := initMockApollo(t) - configs, err := configuration.GetProperties(mockNamespace, config_center.WithGroup("dubbo")) - assert.NoError(t, err) - koan := koanf.New(".") - err = koan.Load(rawbytes.Provider([]byte(configs)), yaml.Parser()) - assert.NoError(t, err) - rc := &config.RootConfig{} - err = koan.UnmarshalWithConf(rc.Prefix(), rc, koanf.UnmarshalConf{Tag: "yaml"}) - assert.NoError(t, err) - - assert.Equal(t, "demo-server", rc.Application.Name) -} - -func TestGetConfigItem(t *testing.T) { - configuration := initMockApollo(t) - configs, err := configuration.GetInternalProperty("content") - assert.NoError(t, err) - configuration.SetParser(&parser.DefaultConfigurationParser{}) - assert.NoError(t, err) - type MockRes struct { - Configurations struct { - Content string - } - } - mockRes := &MockRes{} - err = json.Unmarshal([]byte(mockConfigRes), mockRes) - assert.NoError(t, err) - assert.Equal(t, mockRes.Configurations.Content, configs) -} - -func initMockApollo(t *testing.T) *apolloConfiguration { - c := &config.RootConfig{ConfigCenter: &config.CenterConfig{ - Protocol: "apollo", - Address: "106.12.25.204:8080", - AppID: "testApplication_yang", - Cluster: "dev", - Namespace: "mockDubbogo.yaml", - }} - apollo := initApollo() - apolloUrl := strings.ReplaceAll(apollo.URL, "http", "apollo") - url, err := common.NewURL(apolloUrl, common.WithParams(c.ConfigCenter.GetUrlMap())) - assert.NoError(t, err) - configuration, err := newApolloConfiguration(url) - assert.NoError(t, err) - return configuration -} - -func TestListener(t *testing.T) { - listener := &apolloDataListener{} - listener.wg.Add(2) - apollo := initMockApollo(t) - mockConfigRes = `{ - "appId": "testApplication_yang", - "cluster": "default", - "namespaceName": "mockDubbogo.yaml", - "configurations": { - "registries.hangzhouzk.username": "11111" - }, - "releaseKey": "20191104105242-0f13805d89f834a4" -}` - // test add - apollo.AddListener(mockNamespace, listener) - listener.wg.Wait() - assert.Equal(t, "mockDubbogo.yaml", listener.event) - assert.Greater(t, listener.count, 0) - - // test remove - apollo.RemoveListener(mockNamespace, listener) - listenerCount := 0 - apollo.listeners.Range(func(_, value interface{}) bool { - apolloListener := value.(*apolloListener) - for e := range apolloListener.listeners { - t.Logf("listener:%v", e) - listenerCount++ - } - return true - }) - assert.Equal(t, listenerCount, 0) -} - -type apolloDataListener struct { - wg sync.WaitGroup - count int - event string -} - -func (l *apolloDataListener) Process(configType *config_center.ConfigChangeEvent) { - if configType.ConfigType != remoting.EventTypeUpdate { - return - } - l.wg.Done() - l.count++ - l.event = configType.Key -} diff --git a/config_center/apollo/listener.go b/config_center/apollo/listener.go deleted file mode 100644 index 9080b73877..0000000000 --- a/config_center/apollo/listener.go +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 apollo - -import ( - "github.com/zouyx/agollo/v3" - "github.com/zouyx/agollo/v3/storage" - - "gopkg.in/yaml.v2" -) - -import ( - "dubbo.apache.org/dubbo-go/v3/common/logger" - "dubbo.apache.org/dubbo-go/v3/config_center" - "dubbo.apache.org/dubbo-go/v3/remoting" -) - -type apolloListener struct { - listeners map[config_center.ConfigurationListener]struct{} -} - -// nolint -func newApolloListener() *apolloListener { - return &apolloListener{ - listeners: make(map[config_center.ConfigurationListener]struct{}), - } -} - -// OnChange process each listener -func (a *apolloListener) OnChange(changeEvent *storage.ChangeEvent) { -} - -// OnNewestChange process each listener by all changes -func (a *apolloListener) OnNewestChange(changeEvent *storage.FullChangeEvent) { - b, err := yaml.Marshal(changeEvent.Changes) - if err != nil { - logger.Errorf("apollo onNewestChange err %+v", - err) - return - } - content := string(b) - for listener := range a.listeners { - listener.Process(&config_center.ConfigChangeEvent{ - ConfigType: remoting.EventTypeUpdate, - Key: changeEvent.Namespace, - Value: content, - }) - } -} - -// AddListener adds a listener for apollo -func (a *apolloListener) AddListener(l config_center.ConfigurationListener) { - if _, ok := a.listeners[l]; !ok { - a.listeners[l] = struct{}{} - agollo.AddChangeListener(a) - } -} - -// RemoveListener removes listeners of apollo -func (a *apolloListener) RemoveListener(l config_center.ConfigurationListener) { - delete(a.listeners, l) -} diff --git a/config_center/apollo/mockDubbogo.yaml.json b/config_center/apollo/mockDubbogo.yaml.json deleted file mode 100644 index 4131bededc..0000000000 --- a/config_center/apollo/mockDubbogo.yaml.json +++ /dev/null @@ -1 +0,0 @@ -{"appId":"testApplication_yang","cluster":"default","namespaceName":"mockDubbogo.yaml","releaseKey":"20191104105242-0f13805d89f834a4","configurations":{"registries.hangzhouzk.username":"11111"}} diff --git a/imports/imports.go b/imports/imports.go index fdb8458785..9e26015fae 100644 --- a/imports/imports.go +++ b/imports/imports.go @@ -34,7 +34,6 @@ import ( _ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/roundrobin" _ "dubbo.apache.org/dubbo-go/v3/cluster/router/meshrouter" _ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory" - _ "dubbo.apache.org/dubbo-go/v3/config_center/apollo" _ "dubbo.apache.org/dubbo-go/v3/config_center/nacos" _ "dubbo.apache.org/dubbo-go/v3/config_center/zookeeper" _ "dubbo.apache.org/dubbo-go/v3/filter/accesslog"