You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/09/19 03:05:45 UTC

[dubbo-go-samples] branch config-enhance updated: docs(geninv): update docs (#250)

This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch config-enhance
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git


The following commit(s) were added to refs/heads/config-enhance by this push:
     new 623833a  docs(geninv): update docs (#250)
623833a is described below

commit 623833ab1d28b8e159a851ecef35c5ecc1fb0fa4
Author: XavierNiu <a...@nxw.name>
AuthorDate: Sun Sep 19 11:05:41 2021 +0800

    docs(geninv): update docs (#250)
    
    * docs(geninv): update docs
    
    * docs(geninv): update docs
---
 generic/README.md    | 56 +++++++++++++++++++++++++++++++---------------------
 generic/README_zh.md | 54 +++++++++++++++++++++++++++++---------------------
 2 files changed, 65 insertions(+), 45 deletions(-)

diff --git a/generic/README.md b/generic/README.md
index b1e67f1..84f7cf5 100644
--- a/generic/README.md
+++ b/generic/README.md
@@ -1,42 +1,52 @@
 # Generic Invocation
 
-Generic invocation is mainly used when the client does not have API interface or model class, all POJOs in parameters and return values are represented by map or other generic data structures. Commonly used for framework integration such as: implementing a common service testing framework, all service implementations can be invoked via `GenericService`. For more information please visit our documentation.
+Generic invocation ensures the RPC could be passed properly even if one of clients has no information about interface, because generic invocation converts the POJO to a generic type, like dictionary, string, etc. It is often used for testing and gateways. Please visit our documentation for more details.
 
 ## Getting Started
 
-### Instructions
+The samples of generic invocation are parted by the way of generalization:
 
-1. Start zookeeper
+- default:uses MapGeneralizer which converts POJOs to maps
 
-   ```shell
-   cd ./default/go-server/docker \
-     && docker-compose up -d
-   ```
+Each sample contains 4 subfolders:
 
-2. Start the server to run provider.
+- go-server:Dubbo-Go v3 server sample
+- go-client:Dubbo-Go v3 client sample
+- java-client:Dubbo v3 server sample
+- java-server:Dubbo v3 client sample
 
-   1. go
+Providing java samples is convenient to test interoperability between Dubbo and Dubbo-Go.
 
-      Use goland to start generic-default-go-server
+### Registry
 
-   2. java
+This sample uses ZooKeeper as the registry. In fact, etcd and Nacos are supported as well. Executing the following command, a ZooKeeper instance will be launched. Please note that docker and docker-compose **SHOULD** be installed before.
 
-      Use goland to start generic-default-java-server
-      
-      or
+```shell
+cd ./default/go-server/docker \
+  && docker-compose up -d
+```
+### Server
 
-      Execute `sh run.sh` in the java-server folder to start the java server
+There are two ways to launch a Dubbo-Go server: using GoLand or using command line tool.
 
-3. Start the client to run consumers to initiate generic invocation.
+Using GoLand. Please select `v3config-generic/generic-default-go-server` from Configurations at top-right corner, and then click Run button.
 
-   1. go
+Using command line tool. The `$ProjectRootDir` is the root directory of the dubbo-go-samples project.
 
-      Use goland to start generic-default-go-client
+```shell
+cd $ProjectRootDir/generic/default/go-server/cmd \
+  && go run server.go
+```
 
-   2. java
+### Client
 
-      Use goland to start generic-default-java-client
-   
-      or
+There are two ways to launch a Dubbo-Go client: using GoLand or using command line tool.
 
-      Execute `sh run.sh` in the java-client folder to start the java client
\ No newline at end of file
+Using GoLand. Please select `v3config-generic/generic-default-go-client` from Configurations at top-right corner, and then click Run button.
+
+Using command line tool. The `$ProjectRootDir` is the root directory of the dubbo-go-samples project.
+
+```shell
+cd $ProjectRootDir/generic/default/go-client/cmd \
+  && go run client.go
+```
diff --git a/generic/README_zh.md b/generic/README_zh.md
index 672b989..b3d72f7 100644
--- a/generic/README_zh.md
+++ b/generic/README_zh.md
@@ -1,42 +1,52 @@
 # 泛化调用
 
-泛化接口调用方式主要用于客户端没有 API 接口及模型类元的情况,参数及返回值中的所有 POJO 均用 Map 表示,通常用于框架集成,比如:实现一个通用的服务测试框架,可通过`GenericService`调用所有服务实现。更多信息请参考文档。
+泛化调用是在客户端没有接口信息时保证信息被正确传递的手段,即把 POJO 泛化为通用格式(如字典、字符串),一般被用于集成测试、网关等场景。
 
 ## 开始
 
-### 使用方法
+泛化调用例子根据泛化方式划分为:
 
-1. 启动 zookeeper
+- default:默认泛化方式,即 Map 泛化方式
 
-   ```shell
-   cd ./default/go-server/docker \
-     && docker-compose up -d
-   ```
+在每种泛化调用的例子中,又包含四种文件:
 
-2. 启动服务端运行提供者
+- go-server:Dubbo-Go v3 server 例子
+- go-client:Dubbo-Go v3 client 例子
+- java-client:Dubbo v3 server 例子
+- java-server:Dubbo v3 client 例子
 
-   1. go
+Dubbo Java 例子可以方便测试与 Dubbo-Go 的互通性,可以启动 java server 或 go client,或者 go server 和 java client 进行测试。
 
-      使用 goland 启动 generic-default-go-server
+### 注册中心
 
-   2. java
+本例子中使用 ZooKeeper 作为注册中心,也支持 etcd、Nacos 等作为注册中心。下面命令表示从 docker 中启动 ZooKeeper,所以需要首先确保 docker 和 docker-compose 是否已经安装。
 
-      在goland启动generic-default-java-server
-      
-      或
+```shell
+cd ./default/go-server/docker \
+  && docker-compose up -d
+```
+### 服务端
 
-      在 java-server 文件夹下执行 `sh run.sh` 启动 java server
+使用 Dubbo-Go 作为 provider,有两种方案可供选择:使用 GoLand 启动或从命令行工具启动。
 
-3. 启动客户端运行消费者发启泛化调用
+使用 GoLand 启动。需要在右上角 Configurations 中选择 `v3config-generic/generic-default-go-server`,点击 Run 按钮运行即可。
 
-   1. go
+从命令行工具启动。`$ProjectRootDir` 是指 dubbo-go-samples 项目根目录。
 
-      使用 goland 启动 generic-default-go-client
+```shell
+cd $ProjectRootDir/generic/default/go-server/cmd \
+  && go run server.go
+```
 
-   2. java
+### 客户端
 
-      在goland启动generic-default-java-client
+使用 Dubbo-Go 作为 consumer,有两种方案可供选择:使用 GoLand 启动和从命令行工具启动。
 
-      或
+使用 GoLand 启动。需要在右上角 Configurations 中选择 `v3config-generic/generic-default-go-client`,点击 Run 按钮运行即可。
 
-      在 java-client 文件夹下执行 `sh run.sh` 启动 java client
\ No newline at end of file
+从命令行工具启动。`$ProjectRootDir` 是指 dubbo-go-samples 项目根目录。
+
+```shell
+cd $ProjectRootDir/generic/default/go-client/cmd \
+  && go run client.go
+```