You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Parksosaurus (via GitHub)" <gi...@apache.org> on 2024/03/11 10:52:44 UTC

[PR] feat: add config center examples [dubbo-go-samples]

Parksosaurus opened a new pull request, #709:
URL: https://github.com/apache/dubbo-go-samples/pull/709

   Added example with nacos and zookeeper as the configuration center.


-- 
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@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] feat: add config center examples [dubbo-go-samples]

Posted by "FinalT (via GitHub)" <gi...@apache.org>.
FinalT commented on code in PR #709:
URL: https://github.com/apache/dubbo-go-samples/pull/709#discussion_r1520729560


##########
config_center/zookeeper/proto/greet.proto:
##########
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+
+package greet;
+
+option go_package = "github.com/apache/dubbo-go-samples/context/proto;greet";

Review Comment:
   ```suggestion
   option go_package = "github.com/apache/dubbo-go-samples/config_center/zookeeper/proto;greet";
   ```



##########
config_center/nacos/README_zn.md:
##########
@@ -0,0 +1,70 @@
+# Dubbo-go Config-Center Sample
+
+## 1. 介绍
+
+This example shows dubbo-go's dynamic configuration feature with Nacos as config-center.

Review Comment:
   Please use Chinese



##########
integrate_test/helloworld/tests/integration/main_test.go:
##########
@@ -18,13 +18,11 @@
 package integration
 
 import (
+	"dubbo.apache.org/dubbo-go/v3/client"
+	greet "github.com/apache/dubbo-go-samples/helloworld/proto"
 	"os"
 	"testing"
 
-	greet "github.com/apache/dubbo-go-samples/helloworld/proto"
-
-	"dubbo.apache.org/dubbo-go/v3/client"
-
 	_ "dubbo.apache.org/dubbo-go/v3/imports"
 )

Review Comment:
   plz format imports



##########
config_center/nacos/proto/greet.proto:
##########
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+
+package greet;
+
+option go_package = "github.com/apache/dubbo-go-samples/context/proto;greet";

Review Comment:
   ```suggestion
   option go_package = "github.com/apache/dubbo-go-samples/config_center/nacos/proto;greet";
   ```



##########
config_center/zookeeper/README_zn.md:
##########
@@ -0,0 +1,70 @@
+# Dubbo-go Config-Center Sample
+
+## 1. 介绍
+
+This example shows dubbo-go's dynamic configuration feature with Zookeeper as config-center.

Review Comment:
   Please use Chinese



##########
config_center/nacos/README_zn.md:
##########
@@ -0,0 +1,70 @@
+# Dubbo-go Config-Center Sample
+
+## 1. 介绍
+
+This example shows dubbo-go's dynamic configuration feature with Nacos as config-center.
+
+## 2. 如何运行
+
+### 把配置文件配置到nacos中
+
+```yaml
+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
+```
+
+Open `https://localhost:8848/nacos/` with browser, make sure the relevant configuration is already in place in nacos.

Review Comment:
   ditto.



##########
config_center/zookeeper/README_zn.md:
##########
@@ -0,0 +1,70 @@
+# Dubbo-go Config-Center Sample
+
+## 1. 介绍
+
+This example shows dubbo-go's dynamic configuration feature with Zookeeper as config-center.
+
+## 2. 如何运行
+
+### 把配置文件配置到zookeeper中
+
+```yaml
+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
+```
+
+Open the local zookeeper client to see if the configuration is successful

Review Comment:
   ditto.



-- 
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@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] feat: add config center examples [dubbo-go-samples]

Posted by "FinalT (via GitHub)" <gi...@apache.org>.
FinalT merged PR #709:
URL: https://github.com/apache/dubbo-go-samples/pull/709


-- 
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@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] feat: add config center examples [dubbo-go-samples]

Posted by "FinalT (via GitHub)" <gi...@apache.org>.
FinalT commented on code in PR #709:
URL: https://github.com/apache/dubbo-go-samples/pull/709#discussion_r1519688297


##########
integrate_test/config_center/nacos/tests/integration/main_test.go:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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 (
+	"dubbo.apache.org/dubbo-go/v3"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config_center"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+	greet "github.com/apache/dubbo-go-samples/config_center/nacos/proto"
+	"os"
+	"testing"
+	"time"
+)

Review Comment:
   ditto.



##########
config_center/zookeeper/go-client/cmd/main.go:
##########
@@ -0,0 +1,85 @@
+/*
+ * 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"
+	"dubbo.apache.org/dubbo-go/v3"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config_center"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+	greet "github.com/apache/dubbo-go-samples/config_center/zookeeper/proto"
+	"github.com/dubbogo/gost/log/logger"
+	"time"

Review Comment:
   ditto.



##########
integrate_test/config_center/nacos/tests/integration/config_center_nacos_test.go:
##########
@@ -0,0 +1,36 @@
+/*
+ * 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"
+	greet "github.com/apache/dubbo-go-samples/config_center/nacos/proto"
+	"github.com/stretchr/testify/assert"
+	"testing"
+)

Review Comment:
   ditto.



##########
config_center/nacos/README.md:
##########
@@ -0,0 +1,68 @@
+# Dubbo-go Config-Center Sample
+
+## 1. Introduction
+
+This example shows dubbo-go's dynamic configuration feature with Nacos as config-center.
+
+## 2. How to run
+
+### Add configuration to the configuration center of nacos
+
+```go
+dynamicConfig, err := config.NewConfigCenterConfigBuilder().
+SetProtocol("nacos").
+SetAddress("127.0.0.1:8848").
+Build().GetDynamicConfiguration()
+
+if err != nil {
+    panic(err)
+}
+
+if err := dynamicConfig.PublishConfig("dubbo-go-samples-configcenter-nacos-server", "dubbo", configCenterNacosServerConfig); err != nil {
+    panic(err)
+}
+time.Sleep(time.Second * 10)
+```
+Open `https://localhost:8848/nacos/` with browser, make sure the relevant configuration is already in place in nacos.

Review Comment:
   I think just introduce the configuration in the config center, and how to use it.



##########
config_center/zookeeper/README.md:
##########
@@ -0,0 +1,68 @@
+# Dubbo-go Config-Center Sample
+
+## 1. Introduction
+
+This example shows dubbo-go's dynamic configuration feature with Zookeeper as config-center.
+
+## 2. How to run
+
+### Add configuration to the configuration center of zookeeper
+
+```go
+dynamicConfig, err := config.NewConfigCenterConfigBuilder().
+SetProtocol("zookeeper").
+SetAddress("127.0.0.1:2181").
+Build().GetDynamicConfiguration()
+if err != nil {
+    panic(err)
+}
+
+if err := dynamicConfig.PublishConfig("dubbo-go-samples-configcenter-zookeeper-server", "dubbogo", configCenterZKServerConfig); err != nil {
+    panic(err)
+}
+time.Sleep(time.Second * 10)
+```

Review Comment:
   ditto.



##########
config_center/nacos/go-client/cmd/main.go:
##########
@@ -0,0 +1,85 @@
+/*
+ * 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"
+	"dubbo.apache.org/dubbo-go/v3"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config_center"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+	greet "github.com/apache/dubbo-go-samples/config_center/nacos/proto"
+	"github.com/dubbogo/gost/log/logger"
+	"time"
+)
+
+const configCenterNacosClientConfig = `## 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 
+`
+
+func main() {
+	dynamicConfig, err := config.NewConfigCenterConfigBuilder().
+		SetProtocol("nacos").
+		SetAddress("127.0.0.1:8848").
+		Build().GetDynamicConfiguration()
+	if err != nil {
+		panic(err)
+	}
+	if err = dynamicConfig.PublishConfig("dubbo-go-samples-configcenter-nacos-client", "dubbo", configCenterNacosClientConfig); err != nil {
+		panic(err)
+	}

Review Comment:
   It would be better to use the `nacos-sdk-go` directly, as we plan to remove the `config` package in the future



##########
integrate_test/helloworld/tests/integration/main_test.go:
##########
@@ -18,13 +18,11 @@
 package integration
 
 import (
+	"dubbo.apache.org/dubbo-go/v3/client"
+	greet "github.com/apache/dubbo-go-samples/helloworld/proto"
 	"os"
 	"testing"
 
-	greet "github.com/apache/dubbo-go-samples/helloworld/proto"
-
-	"dubbo.apache.org/dubbo-go/v3/client"
-
 	_ "dubbo.apache.org/dubbo-go/v3/imports"
 )

Review Comment:
   ditto.



##########
config_center/nacos/go-server/cmd/main.go:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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"
+	"dubbo.apache.org/dubbo-go/v3"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config_center"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+	greet "github.com/apache/dubbo-go-samples/config_center/nacos/proto"
+	"github.com/dubbogo/gost/log/logger"
+	"time"
+)
+
+type GreetTripleServer struct {
+}
+
+func (srv *GreetTripleServer) Greet(ctx context.Context, req *greet.GreetRequest) (*greet.GreetResponse, error) {
+	resp := &greet.GreetResponse{Greeting: req.Name}
+	return resp, nil
+}
+
+const configCenterNacosServerConfig = `## 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
+`
+
+func main() {
+	dynamicConfig, err := config.NewConfigCenterConfigBuilder().
+		SetProtocol("nacos").
+		SetAddress("127.0.0.1:8848").
+		Build().GetDynamicConfiguration()
+
+	if err != nil {
+		panic(err)
+	}
+
+	if err = dynamicConfig.PublishConfig("dubbo-go-samples-configcenter-nacos-server", "dubbo", configCenterNacosServerConfig); err != nil {
+		panic(err)
+	}
+	time.Sleep(time.Second * 10)

Review Comment:
   ditto.



##########
integrate_test/config_center/zookeeper/tests/integration/main_test.go:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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 (
+	"dubbo.apache.org/dubbo-go/v3"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config_center"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+	greet "github.com/apache/dubbo-go-samples/config_center/zookeeper/proto"
+	"os"
+	"testing"
+	"time"
+)

Review Comment:
   ditto.



##########
config_center/nacos/go-server/cmd/main.go:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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"
+	"dubbo.apache.org/dubbo-go/v3"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config_center"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+	greet "github.com/apache/dubbo-go-samples/config_center/nacos/proto"
+	"github.com/dubbogo/gost/log/logger"
+	"time"

Review Comment:
   ditto.



##########
config_center/zookeeper/go-server/cmd/main.go:
##########
@@ -0,0 +1,92 @@
+/*
+ * 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"
+	"dubbo.apache.org/dubbo-go/v3"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config_center"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+	greet "github.com/apache/dubbo-go-samples/config_center/zookeeper/proto"
+	"github.com/dubbogo/gost/log/logger"
+	"time"
+)

Review Comment:
   ditto.



##########
integrate_test/config_center/zookeeper/tests/integration/config_center_nacos_test.go:
##########
@@ -0,0 +1,36 @@
+/*
+ * 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"
+	greet "github.com/apache/dubbo-go-samples/config_center/zookeeper/proto"
+	"github.com/stretchr/testify/assert"
+	"testing"
+)

Review Comment:
   ditto.



##########
config_center/nacos/go-client/cmd/main.go:
##########
@@ -0,0 +1,85 @@
+/*
+ * 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"
+	"dubbo.apache.org/dubbo-go/v3"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config_center"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+	greet "github.com/apache/dubbo-go-samples/config_center/nacos/proto"
+	"github.com/dubbogo/gost/log/logger"
+	"time"

Review Comment:
   plz format imports



##########
config_center/zookeeper/go-server/cmd/main.go:
##########
@@ -0,0 +1,92 @@
+/*
+ * 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"
+	"dubbo.apache.org/dubbo-go/v3"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config_center"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+	greet "github.com/apache/dubbo-go-samples/config_center/zookeeper/proto"
+	"github.com/dubbogo/gost/log/logger"
+	"time"
+)
+
+type GreetTripleServer struct {
+}
+
+func (srv *GreetTripleServer) Greet(ctx context.Context, req *greet.GreetRequest) (*greet.GreetResponse, error) {
+	resp := &greet.GreetResponse{Greeting: req.Name}
+	return resp, nil
+}
+
+const configCenterZKServerConfig = `## set in config center, group is 'dubbogo', 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:
+    services:
+      GreeterProvider:
+        interface: com.apache.dubbo.sample.basic.IGreeter
+`
+
+func main() {
+	dynamicConfig, err := config.NewConfigCenterConfigBuilder().
+		SetProtocol("zookeeper").
+		SetAddress("127.0.0.1:2181").
+		Build().GetDynamicConfiguration()
+	if err != nil {
+		panic(err)
+	}
+
+	if err = dynamicConfig.PublishConfig("dubbo-go-samples-configcenter-zookeeper-server", "dubbogo", configCenterZKServerConfig); err != nil {
+		panic(err)
+	}
+	time.Sleep(time.Second * 10)

Review Comment:
   ditto.



##########
config_center/zookeeper/go-client/cmd/main.go:
##########
@@ -0,0 +1,85 @@
+/*
+ * 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"
+	"dubbo.apache.org/dubbo-go/v3"
+	"dubbo.apache.org/dubbo-go/v3/config"
+	"dubbo.apache.org/dubbo-go/v3/config_center"
+	_ "dubbo.apache.org/dubbo-go/v3/imports"
+	greet "github.com/apache/dubbo-go-samples/config_center/zookeeper/proto"
+	"github.com/dubbogo/gost/log/logger"
+	"time"
+)
+
+const configCenterZKClientConfig = `## set in config center, group is 'dubbogo', 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:
+    references:
+      GreeterClientImpl:
+        protocol: tri
+        interface: com.apache.dubbo.sample.basic.IGreeter 
+`
+
+func main() {
+	dynamicConfig, err := config.NewConfigCenterConfigBuilder().
+		SetProtocol("zookeeper").
+		SetAddress("127.0.0.1:2181").
+		Build().GetDynamicConfiguration()
+	if err != nil {
+		panic(err)
+	}
+	if err = dynamicConfig.PublishConfig("dubbo-go-samples-configcenter-zookeeper-client", "dubbogo", configCenterZKClientConfig); err != nil {
+		panic(err)
+	}
+
+	time.Sleep(time.Second * 10)

Review Comment:
   ditto.



-- 
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@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] feat: add config center examples [dubbo-go-samples]

Posted by "FinalT (via GitHub)" <gi...@apache.org>.
FinalT commented on PR #709:
URL: https://github.com/apache/dubbo-go-samples/pull/709#issuecomment-1991007572

   plz resolve conflicts


-- 
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@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org