This is an automated email from the ASF dual-hosted git repository.
xuetaoli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/main by this push:
new f876fa10 chore: remove duplicated configCenter (#995)
f876fa10 is described below
commit f876fa1026d1bf4164be6363e96c77ddd4231cd5
Author: zbchi <[email protected]>
AuthorDate: Sat Dec 13 16:01:07 2025 +0800
chore: remove duplicated configCenter (#995)
---
README.md | 1 -
README_CN.md | 1 -
.../configcenter/nacos/go-client/cmd/client.go | 56 --------------------
.../configcenter/nacos/go-client/conf/dubbogo.yml | 21 --------
.../configcenter/nacos/go-server/cmd/server.go | 50 ------------------
.../configcenter/nacos/go-server/conf/dubbogo.yml | 23 ---------
.../configcenter/zookeeper/go-client/cmd/client.go | 56 --------------------
.../zookeeper/go-client/conf/dubbogo.yml | 20 --------
.../configcenter/zookeeper/go-server/cmd/server.go | 50 ------------------
.../zookeeper/go-server/conf/dubbogo.yml | 24 ---------
.../tests/integration/greeterProvider_test.go | 44 ----------------
.../apollo/tests/integration/main_test.go | 44 ----------------
.../nacos/tests/integration/main_test.go | 59 ----------------------
.../nacos/tests/integration/userprovider_test.go | 36 -------------
14 files changed, 485 deletions(-)
diff --git a/README.md b/README.md
index 0fb005b5..e3f2a402 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,6 @@ A collection of runnable Dubbo-go examples covering
configuration, registries, o
* `compatibility/apisix`: Example integrating Apache APISIX with Dubbo-go.
* `compatibility/config-api`: Shows how to use Dubbo-go via APIs without
configuration files.
-* `compatibility/configcenter`: Usage of different config centers, including
Zookeeper, Nacos, and Apollo.
* `compatibility/generic`: Generic invocation example.
* `compatibility/mesh`: Proxy-based service mesh example showing how to deploy
Dubbo-go services with Envoy on Kubernetes.
* `compatibility/proxyless`: Proxyless service mesh example for deploying
Dubbo-go services on Kubernetes.
diff --git a/README_CN.md b/README_CN.md
index 204eb43b..7d2a7f99 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -49,7 +49,6 @@
* `compatibility/apisix`:Dubbo-go 集成 Apache APISIX 的示例。
* `compatibility/config-api`:演示如何在不使用配置文件的情况下,通过 API 使用 Dubbo-go。
-* `compatibility/configcenter`:不同配置中心的使用示例,包括 Zookeeper、Nacos 和 Apollo。
* `compatibility/generic`:泛化调用示例。
* `compatibility/mesh`:基于代理的服务网格示例,展示如何在 Kubernetes 上结合 Envoy 部署 Dubbo-go 服务。
* `compatibility/proxyless`:无 Sidecar 的服务网格示例,展示在 Kubernetes 上的部署方式。
diff --git a/compatibility/configcenter/nacos/go-client/cmd/client.go
b/compatibility/configcenter/nacos/go-client/cmd/client.go
deleted file mode 100644
index ad774061..00000000
--- a/compatibility/configcenter/nacos/go-client/cmd/client.go
+++ /dev/null
@@ -1,56 +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 main
-
-import (
- "context"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/config"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
-
- "github.com/dubbogo/gost/log/logger"
-)
-
-import (
- "github.com/apache/dubbo-go-samples/compatibility/api"
-)
-
-var grpcGreeterImpl = new(api.GreeterClientImpl)
-
-func init() {
- config.SetConsumerService(grpcGreeterImpl)
-}
-
-// export DUBBO_GO_CONFIG_PATH=
PATH_TO_SAMPLES/helloworld/go-client/conf/dubbogo.yml
-func main() {
- if err := config.Load(); err != nil {
- panic(err)
- }
-
- logger.Info("start to test dubbo")
- req := &api.HelloRequest{
- Name: "laurence",
- }
- reply, err := grpcGreeterImpl.SayHello(context.Background(), req)
- if err != nil {
- logger.Error(err)
- }
- logger.Infof("client response result: %v\n", reply)
-}
diff --git a/compatibility/configcenter/nacos/go-client/conf/dubbogo.yml
b/compatibility/configcenter/nacos/go-client/conf/dubbogo.yml
deleted file mode 100644
index 6c48c71d..00000000
--- a/compatibility/configcenter/nacos/go-client/conf/dubbogo.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-dubbo:
- config-center:
- protocol: nacos
- address: 127.0.0.1:8848
- data-id: dubbo-go-samples-configcenter-nacos-client
- group: myGroup # default is DEFAULT_GROUP
-# namespace: 9fb00abb-278d-42fc-96bf-e0151601e4a1 # default is public
-
-
-## set in config center, group is 'dubbo', dataid is
'dubbo-go-samples-configcenter-nacos-client', namespace is default
-#dubbo:
-# registries:
-# demoZK:
-# protocol: zookeeper
-# timeout: 3s
-# address: 127.0.0.1:2181
-# consumer:
-# references:
-# GreeterClientImpl:
-# protocol: tri
-# interface: com.apache.dubbo.sample.basic.IGreeter # must be
compatible with grpc or dubbo-java
\ No newline at end of file
diff --git a/compatibility/configcenter/nacos/go-server/cmd/server.go
b/compatibility/configcenter/nacos/go-server/cmd/server.go
deleted file mode 100644
index 548dec84..00000000
--- a/compatibility/configcenter/nacos/go-server/cmd/server.go
+++ /dev/null
@@ -1,50 +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 main
-
-import (
- "context"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/config"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
-
- "github.com/dubbogo/gost/log/logger"
-)
-
-import (
- "github.com/apache/dubbo-go-samples/compatibility/api"
-)
-
-type GreeterProvider struct {
- api.UnimplementedGreeterServer
-}
-
-func (s *GreeterProvider) SayHello(ctx context.Context, in *api.HelloRequest)
(*api.User, error) {
- logger.Infof("Dubbo3 GreeterProvider get user name = %s\n", in.Name)
- return &api.User{Name: "Hello " + in.Name, Id: "12345", Age: 21}, nil
-}
-
-func main() {
- config.SetProviderService(&GreeterProvider{})
- if err := config.Load(); err != nil {
- panic(err)
- }
- select {}
-}
diff --git a/compatibility/configcenter/nacos/go-server/conf/dubbogo.yml
b/compatibility/configcenter/nacos/go-server/conf/dubbogo.yml
deleted file mode 100644
index 018acfec..00000000
--- a/compatibility/configcenter/nacos/go-server/conf/dubbogo.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-dubbo:
- config-center:
- protocol: nacos
- address: 127.0.0.1:8848
- data-id: dubbo-go-samples-configcenter-nacos-server
- group: myGroup # nacos group, default is DEFAULT_GROUP
-# namespace: 9fb00abb-278d-42fc-96bf-e0151601e4a1 # nacos namespaceID,
default is public namespace
-
-## set in config center, group is 'dubbo', dataid is
'dubbo-go-samples-configcenter-nacos-server', namespace is default
-#dubbo:
-# registries:
-# demoZK:
-# protocol: zookeeper
-# timeout: 3s
-# address: 127.0.0.1:2181
-# protocols:
-# triple:
-# name: tri
-# port: 20000
-# provider:
-# services:
-# GreeterProvider:
-# interface: com.apache.dubbo.sample.basic.IGreeter # must be
compatible with grpc or dubbo-java
\ No newline at end of file
diff --git a/compatibility/configcenter/zookeeper/go-client/cmd/client.go
b/compatibility/configcenter/zookeeper/go-client/cmd/client.go
deleted file mode 100644
index ad774061..00000000
--- a/compatibility/configcenter/zookeeper/go-client/cmd/client.go
+++ /dev/null
@@ -1,56 +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 main
-
-import (
- "context"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/config"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
-
- "github.com/dubbogo/gost/log/logger"
-)
-
-import (
- "github.com/apache/dubbo-go-samples/compatibility/api"
-)
-
-var grpcGreeterImpl = new(api.GreeterClientImpl)
-
-func init() {
- config.SetConsumerService(grpcGreeterImpl)
-}
-
-// export DUBBO_GO_CONFIG_PATH=
PATH_TO_SAMPLES/helloworld/go-client/conf/dubbogo.yml
-func main() {
- if err := config.Load(); err != nil {
- panic(err)
- }
-
- logger.Info("start to test dubbo")
- req := &api.HelloRequest{
- Name: "laurence",
- }
- reply, err := grpcGreeterImpl.SayHello(context.Background(), req)
- if err != nil {
- logger.Error(err)
- }
- logger.Infof("client response result: %v\n", reply)
-}
diff --git a/compatibility/configcenter/zookeeper/go-client/conf/dubbogo.yml
b/compatibility/configcenter/zookeeper/go-client/conf/dubbogo.yml
deleted file mode 100644
index bf9d5848..00000000
--- a/compatibility/configcenter/zookeeper/go-client/conf/dubbogo.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-dubbo:
- config-center:
- protocol: zookeeper
- address: 127.0.0.1:2181
- data-id: "dubbo-go-samples-configcenter-zookeeper-client"
-
-## set in config center, group is 'dubbo', dataid is
'dubbo-go-samples-configcenter-zookeeper-client', namespace is default
-#dubbo:
-# registries:
-# demoZK:
-# protocol: zookeeper
-# timeout: 3s
-# address: 127.0.0.1:2181
-# consumer:
-# registry-ids:
-# - demoZK
-# references:
-# GreeterClientImpl:
-# protocol: tri
-# interface: com.apache.dubbo.sample.basic.IGreeter # must be
compatible with grpc or dubbo-java
\ No newline at end of file
diff --git a/compatibility/configcenter/zookeeper/go-server/cmd/server.go
b/compatibility/configcenter/zookeeper/go-server/cmd/server.go
deleted file mode 100644
index 548dec84..00000000
--- a/compatibility/configcenter/zookeeper/go-server/cmd/server.go
+++ /dev/null
@@ -1,50 +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 main
-
-import (
- "context"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/config"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
-
- "github.com/dubbogo/gost/log/logger"
-)
-
-import (
- "github.com/apache/dubbo-go-samples/compatibility/api"
-)
-
-type GreeterProvider struct {
- api.UnimplementedGreeterServer
-}
-
-func (s *GreeterProvider) SayHello(ctx context.Context, in *api.HelloRequest)
(*api.User, error) {
- logger.Infof("Dubbo3 GreeterProvider get user name = %s\n", in.Name)
- return &api.User{Name: "Hello " + in.Name, Id: "12345", Age: 21}, nil
-}
-
-func main() {
- config.SetProviderService(&GreeterProvider{})
- if err := config.Load(); err != nil {
- panic(err)
- }
- select {}
-}
diff --git a/compatibility/configcenter/zookeeper/go-server/conf/dubbogo.yml
b/compatibility/configcenter/zookeeper/go-server/conf/dubbogo.yml
deleted file mode 100644
index dde301c2..00000000
--- a/compatibility/configcenter/zookeeper/go-server/conf/dubbogo.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-dubbo:
- config-center:
- protocol: zookeeper
- address: 127.0.0.1:2181
- data-id: "dubbo-go-samples-configcenter-zookeeper-server"
-
-## set in config center, group is 'dubbo', dataid is
'dubbo-go-samples-configcenter-zookeeper-server', namespace is default
-#dubbo:
-# registries:
-# demoZK:
-# protocol: zookeeper
-# timeout: 3s
-# address: 127.0.0.1:2181
-# protocols:
-# triple:
-# name: "tri"
-# port: 20000
-# provider:
-# registry-ids:
-# - demoZK
-# services:
-# GreeterProvider:
-# protocol: triple
-# interface: com.apache.dubbo.sample.basic.IGreeter # must be
compatible with grpc or dubbo-java
\ No newline at end of file
diff --git
a/integrate_test/compatibility/configcenter/apollo/tests/integration/greeterProvider_test.go
b/integrate_test/compatibility/configcenter/apollo/tests/integration/greeterProvider_test.go
deleted file mode 100644
index b4b59391..00000000
---
a/integrate_test/compatibility/configcenter/apollo/tests/integration/greeterProvider_test.go
+++ /dev/null
@@ -1,44 +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 integration
-
-import (
- "context"
- "testing"
-)
-
-import (
- "github.com/stretchr/testify/assert"
-)
-
-import (
- dubbo3pb "github.com/apache/dubbo-go-samples/compatibility/api"
-)
-
-func TestSayHello(t *testing.T) {
- req := &dubbo3pb.HelloRequest{
- Name: "laurence",
- }
-
- reply, err := greeterProvider.SayHello(context.Background(), req)
-
- assert.Nil(t, err)
- assert.Equal(t, "Hello laurence", reply.Name)
- assert.Equal(t, "12345", reply.Id)
- assert.Equal(t, int32(21), reply.Age)
-}
diff --git
a/integrate_test/compatibility/configcenter/apollo/tests/integration/main_test.go
b/integrate_test/compatibility/configcenter/apollo/tests/integration/main_test.go
deleted file mode 100644
index 4f81a75d..00000000
---
a/integrate_test/compatibility/configcenter/apollo/tests/integration/main_test.go
+++ /dev/null
@@ -1,44 +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 integration
-
-import (
- "os"
- "testing"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/config"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
-)
-
-import (
- dubbo3pb "github.com/apache/dubbo-go-samples/compatibility/api"
-)
-
-var greeterProvider = new(dubbo3pb.GreeterClientImpl)
-
-func TestMain(m *testing.M) {
- config.SetConsumerService(greeterProvider)
- err := config.Load()
- if err != nil {
- panic(err)
- }
-
- os.Exit(m.Run())
-}
diff --git
a/integrate_test/compatibility/configcenter/nacos/tests/integration/main_test.go
b/integrate_test/compatibility/configcenter/nacos/tests/integration/main_test.go
deleted file mode 100644
index 35e3ae8b..00000000
---
a/integrate_test/compatibility/configcenter/nacos/tests/integration/main_test.go
+++ /dev/null
@@ -1,59 +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 integration
-
-import (
- "context"
- "os"
- "testing"
- "time"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/config"
- _ "dubbo.apache.org/dubbo-go/v3/imports"
-
- hessian "github.com/apache/dubbo-go-hessian2"
-)
-
-var userProvider = new(UserProvider)
-
-func TestMain(m *testing.M) {
- config.SetConsumerService(userProvider)
- hessian.RegisterPOJO(&User{})
- if err := config.Load(); err != nil {
- panic(err)
- }
-
- os.Exit(m.Run())
-}
-
-type User struct {
- ID string
- Name string
- Age int32
- Time time.Time
-}
-
-type UserProvider struct {
- GetUser func(ctx context.Context, req *User) (*User, error)
-}
-
-func (u *User) JavaClassName() string {
- return "org.apache.dubbo.User"
-}
diff --git
a/integrate_test/compatibility/configcenter/nacos/tests/integration/userprovider_test.go
b/integrate_test/compatibility/configcenter/nacos/tests/integration/userprovider_test.go
deleted file mode 100644
index fbb9061d..00000000
---
a/integrate_test/compatibility/configcenter/nacos/tests/integration/userprovider_test.go
+++ /dev/null
@@ -1,36 +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 integration
-
-import (
- "context"
- "testing"
-)
-
-import (
- "github.com/stretchr/testify/assert"
-)
-
-func TestGetUser(t *testing.T) {
- user, err := userProvider.GetUser(context.TODO(), &User{ID: "A001"})
- assert.Nil(t, err)
- assert.Equal(t, "A001", user.ID)
- assert.Equal(t, "Alex Stocks", user.Name)
- assert.Equal(t, int32(18), user.Age)
- assert.NotNil(t, user.Time)
-}