You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by ma...@apache.org on 2021/10/09 11:07:47 UTC

[dubbo-go-pixiu] branch develop updated: docs: add http-grpc doc

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

mark4z pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git


The following commit(s) were added to refs/heads/develop by this push:
     new 11d6e86  docs: add http-grpc doc
     new 9ea3fea  Merge pull request #272 from MasterKenway/docs/grpc
11d6e86 is described below

commit 11d6e86f0dd9d2775ef0a1056f8df7f0bcbde4de
Author: MasterKenway <zk...@ikenway.net>
AuthorDate: Fri Oct 8 23:01:18 2021 +0800

    docs: add http-grpc doc
---
 docs/index.md                                      |  2 +-
 docs/sample/README.md                              |  8 +-
 docs/sample/{ => dubbo}/dubbo-body(http).md        |  0
 docs/sample/{ => dubbo}/dubbo-body.md              |  2 +-
 docs/sample/{ => dubbo}/dubbo-error.md             |  2 +-
 docs/sample/{ => dubbo}/dubbo-incomplete.md        |  2 +-
 docs/sample/{ => dubbo}/dubbo-mix.md               |  2 +-
 docs/sample/{ => dubbo}/dubbo-multi.md             |  2 +-
 docs/sample/{ => dubbo}/dubbo-query(http).md       |  0
 docs/sample/{ => dubbo}/dubbo-query.md             |  2 +-
 docs/sample/{ => dubbo}/dubbo-simple-run.md        |  0
 docs/sample/{ => dubbo}/dubbo-universality.md      |  2 +-
 docs/sample/{ => dubbo}/dubbo-uri.md               |  2 +-
 docs/sample/{ => dubbo}/dubbo.md                   |  4 +-
 docs/sample/{ => dubbo}/dubbo_sample_startup.sh    |  0
 docs/sample/{ => http}/http-body.md                |  0
 docs/sample/http/http-grpc.md                      | 89 ++++++++++++++++++++++
 docs/sample/{ => http}/http-query.md               |  0
 docs/sample/{ => http}/http-uri.md                 |  0
 docs/sample/{ => http}/http.md                     |  6 +-
 docs/sample/{ => http}/http_sample_startup.sh      |  0
 docs/sample/mock.md                                |  2 +-
 docs/sample/zh-cn/{ => dubbo}/dubbo-body.md        |  2 +-
 docs/sample/zh-cn/{ => dubbo}/dubbo-mix.md         |  2 +-
 docs/sample/zh-cn/{ => dubbo}/dubbo-multi.md       |  2 +-
 docs/sample/zh-cn/{ => dubbo}/dubbo-query.md       |  2 +-
 docs/sample/zh-cn/{ => dubbo}/dubbo-simple-run.md  |  0
 .../sample/zh-cn/{ => dubbo}/dubbo-universality.md |  2 +-
 docs/sample/zh-cn/{ => dubbo}/dubbo-uri.md         |  2 +-
 docs/sample/zh-cn/{ => dubbo}/dubbo.md             |  2 +-
 30 files changed, 116 insertions(+), 25 deletions(-)

diff --git a/docs/index.md b/docs/index.md
index a7d5032..4a318f0 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -9,7 +9,7 @@
 ## [Samples](sample/README.md)
 
 * [dubbo](sample/dubbo.md)
-* [http](sample/http.md)
+* [http](sample/http/http.md)
 * [mock](sample/mock.md)
 * [plugins](../samples/plugins/index.md)
 
diff --git a/docs/sample/README.md b/docs/sample/README.md
index 903ec66..1635907 100644
--- a/docs/sample/README.md
+++ b/docs/sample/README.md
@@ -1,6 +1,6 @@
-# Samples
+# Document Catalog
  
-[中文](./zh-cn/README.md) 
-* [dubbo](dubbo.md)
-* [http](http.md)
+[中文文档](./zh-cn/README.md) 
+* [dubbo](dubbo/dubbo.md)
+* [http](http/http.md)
 * [mock](mock.md)
\ No newline at end of file
diff --git a/docs/sample/dubbo-body(http).md b/docs/sample/dubbo/dubbo-body(http).md
similarity index 100%
rename from docs/sample/dubbo-body(http).md
rename to docs/sample/dubbo/dubbo-body(http).md
diff --git a/docs/sample/dubbo-body.md b/docs/sample/dubbo/dubbo-body.md
similarity index 99%
rename from docs/sample/dubbo-body.md
rename to docs/sample/dubbo/dubbo-body.md
index 175f6f4..3b445da 100644
--- a/docs/sample/dubbo-body.md
+++ b/docs/sample/dubbo/dubbo-body.md
@@ -126,4 +126,4 @@ result
 true
 ```
 
-[Previous](./dubbo.md)
+[Previous](dubbo.md)
diff --git a/docs/sample/dubbo-error.md b/docs/sample/dubbo/dubbo-error.md
similarity index 99%
rename from docs/sample/dubbo-error.md
rename to docs/sample/dubbo/dubbo-error.md
index 0f4c6bd..8c7bb28 100644
--- a/docs/sample/dubbo-error.md
+++ b/docs/sample/dubbo/dubbo-error.md
@@ -58,4 +58,4 @@ Return value
 2020-11-20T15:56:59.011+0800    ERROR   remote/call.go:112      [dubbo-go-pixiu] client call err:Failed to invoke the method $invoke. No provider available for the service dubbo://:@:/?interface=com.ic.user.UserProvider&group=test&version=1.0.0 from registry zookeeper://127.0.0.1:2181?group=&registry=zookeeper&registry.label=true&registry.preferred=false&registry.role=0&registry.timeout=3s&registry.ttl=&registry.weight=0&registry.zone=&simplified=false on the consumer 30.11.176.51 using  [...]
 ```
 
-[Previous](./dubbo.md)
\ No newline at end of file
+[Previous](dubbo.md)
\ No newline at end of file
diff --git a/docs/sample/dubbo-incomplete.md b/docs/sample/dubbo/dubbo-incomplete.md
similarity index 94%
rename from docs/sample/dubbo-incomplete.md
rename to docs/sample/dubbo/dubbo-incomplete.md
index 0c30dd8..8d91c36 100644
--- a/docs/sample/dubbo-incomplete.md
+++ b/docs/sample/dubbo/dubbo-incomplete.md
@@ -19,4 +19,4 @@ Although User struct has Time value, generic invoke will return nil. [the simple
 
 So I suggest you can use string to time type for a short time.
 
-[Previous](./dubbo.md)
\ No newline at end of file
+[Previous](dubbo.md)
\ No newline at end of file
diff --git a/docs/sample/dubbo-mix.md b/docs/sample/dubbo/dubbo-mix.md
similarity index 99%
rename from docs/sample/dubbo-mix.md
rename to docs/sample/dubbo/dubbo-mix.md
index 1aca614..6a4fd43 100644
--- a/docs/sample/dubbo-mix.md
+++ b/docs/sample/dubbo/dubbo-mix.md
@@ -112,4 +112,4 @@ result
 true
 ```
 
-[Previous](./dubbo.md)
+[Previous](dubbo.md)
diff --git a/docs/sample/dubbo-multi.md b/docs/sample/dubbo/dubbo-multi.md
similarity index 99%
rename from docs/sample/dubbo-multi.md
rename to docs/sample/dubbo/dubbo-multi.md
index ea1fe8c..ec8314b 100644
--- a/docs/sample/dubbo-multi.md
+++ b/docs/sample/dubbo/dubbo-multi.md
@@ -201,4 +201,4 @@ and
 }
 ```
 
-[Previous](./dubbo.md)
+[Previous](dubbo.md)
diff --git a/docs/sample/dubbo-query(http).md b/docs/sample/dubbo/dubbo-query(http).md
similarity index 100%
rename from docs/sample/dubbo-query(http).md
rename to docs/sample/dubbo/dubbo-query(http).md
diff --git a/docs/sample/dubbo-query.md b/docs/sample/dubbo/dubbo-query.md
similarity index 99%
rename from docs/sample/dubbo-query.md
rename to docs/sample/dubbo/dubbo-query.md
index 6bc7149..af160c7 100644
--- a/docs/sample/dubbo-query.md
+++ b/docs/sample/dubbo/dubbo-query.md
@@ -118,4 +118,4 @@ result
 }
 ```
 
-[Previous](./dubbo.md)
+[Previous](dubbo.md)
diff --git a/docs/sample/dubbo-simple-run.md b/docs/sample/dubbo/dubbo-simple-run.md
similarity index 100%
rename from docs/sample/dubbo-simple-run.md
rename to docs/sample/dubbo/dubbo-simple-run.md
diff --git a/docs/sample/dubbo-universality.md b/docs/sample/dubbo/dubbo-universality.md
similarity index 99%
rename from docs/sample/dubbo-universality.md
rename to docs/sample/dubbo/dubbo-universality.md
index bac0571..d344914 100644
--- a/docs/sample/dubbo-universality.md
+++ b/docs/sample/dubbo/dubbo-universality.md
@@ -195,4 +195,4 @@ request body
 
 Please pay attention to the special situation of configuration the degrees of freedom is not very high, if can't meet the scene, please mention [issue](https://github.com/dubbogo/dubbo-go-proxy/issues), thank you.
 
-[Previous](./dubbo.md)
+[Previous](dubbo.md)
diff --git a/docs/sample/dubbo-uri.md b/docs/sample/dubbo/dubbo-uri.md
similarity index 99%
rename from docs/sample/dubbo-uri.md
rename to docs/sample/dubbo/dubbo-uri.md
index 26d09db..14a2d83 100644
--- a/docs/sample/dubbo-uri.md
+++ b/docs/sample/dubbo/dubbo-uri.md
@@ -129,4 +129,4 @@ result
 }
 ```
 
-[Previous](./dubbo.md)
+[Previous](dubbo.md)
diff --git a/docs/sample/dubbo.md b/docs/sample/dubbo/dubbo.md
similarity index 91%
rename from docs/sample/dubbo.md
rename to docs/sample/dubbo/dubbo.md
index 28f919a..99c418d 100644
--- a/docs/sample/dubbo.md
+++ b/docs/sample/dubbo/dubbo.md
@@ -1,4 +1,4 @@
-# Dubbo
+# Dubbo Catalog
 
 * [dubbo-query](dubbo-query.md)
 * [dubbo-body](dubbo-body.md)
@@ -12,4 +12,4 @@
 
 How do I run a simple test example [document](dubbo-simple-run.md)
 
-[Previous](./README.md)
\ No newline at end of file
+[Previous](../README.md)
\ No newline at end of file
diff --git a/docs/sample/dubbo_sample_startup.sh b/docs/sample/dubbo/dubbo_sample_startup.sh
old mode 100755
new mode 100644
similarity index 100%
rename from docs/sample/dubbo_sample_startup.sh
rename to docs/sample/dubbo/dubbo_sample_startup.sh
diff --git a/docs/sample/http-body.md b/docs/sample/http/http-body.md
similarity index 100%
rename from docs/sample/http-body.md
rename to docs/sample/http/http-body.md
diff --git a/docs/sample/http/http-grpc.md b/docs/sample/http/http-grpc.md
new file mode 100644
index 0000000..62b447c
--- /dev/null
+++ b/docs/sample/http/http-grpc.md
@@ -0,0 +1,89 @@
+# Invoke service provider using grpc
+
+> Doc metions below fit the code in the `samples/http/grpc`
+
+## Define Apis in the pixiu/api_config.yaml
+
+```yaml
+name: pixiu
+description: pixiu sample
+resources:
+  - path: '/api/v1/provider.UserProvider/GetUser'
+    type: restful
+    description: user
+    methods:
+      - httpVerb: GET
+        enable: true
+        timeout: 1000ms
+        inboundRequest:
+          requestType: http
+        integrationRequest:
+          requestType: grpc
+          group: "test"
+          version: 1.0.0
+          clusterName: "test_grpc"
+  - path: '/api/v1/provider.UserProvider/GetUser'
+    type: restful
+    description: user
+    methods:
+      - httpVerb: POST
+        enable: true
+        timeout: 1000ms
+        inboundRequest:
+          requestType: http
+        integrationRequest:
+          requestType: grpc
+          group: "test"
+          version: 1.0.0
+          clusterName: "test_grpc"
+```
+
+> WARN: currently http request only support json body to parse params
+
+## Prepare for the Server 
+
+generate pb files under `samples/http/grpc/proto` with command: 
+
+```
+protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative hello_grpc.proto
+```
+
+## Start server 
+
+run `samples/http/grpc/server/app/server.go`
+
+```
+go run server.go
+```
+
+## Build dubbo-go-pixiu
+
+```
+go build -o dubbo-go-pixiu cmd/pixiu/*
+```
+
+Or on Windows, you need to go under `cmd/pixiu` to build binary file
+
+```
+go build -o dubbo-go-pixiu.exe .
+```
+
+## Start Pixiu
+
+```
+./dubbo-go-pixiu gateway start --config samples/http/grpc/pixiu/conf.yaml --log-config samples/http/grpc/pixiu/log.yml
+```
+
+## Test Using Curl
+
+Run command curl using: 
+
+```
+curl http://127.0.0.1:8881/api/v1/provider.UserProvider/GetUser
+```
+
+and 
+
+```
+curl http://127.0.0.1:8881/api/v1/provider.UserProvider/GetUser -X POST -d '{"userId":1}'
+```
\ No newline at end of file
diff --git a/docs/sample/http-query.md b/docs/sample/http/http-query.md
similarity index 100%
rename from docs/sample/http-query.md
rename to docs/sample/http/http-query.md
diff --git a/docs/sample/http-uri.md b/docs/sample/http/http-uri.md
similarity index 100%
rename from docs/sample/http-uri.md
rename to docs/sample/http/http-uri.md
diff --git a/docs/sample/http.md b/docs/sample/http/http.md
similarity index 53%
rename from docs/sample/http.md
rename to docs/sample/http/http.md
index 59bd660..b144277 100644
--- a/docs/sample/http.md
+++ b/docs/sample/http/http.md
@@ -2,7 +2,9 @@
 
 Base on sample/http.
 
-* [http-query](http-query.md)
 * [http-body](http-body.md)
+* [http-gprc](http-grpc.md)
+* [http-query](http-query.md)
+* [http-uri](http-uri.md)
 
-[Previous](./README.md)
\ No newline at end of file
+[Previous](../README.md)
\ No newline at end of file
diff --git a/docs/sample/http_sample_startup.sh b/docs/sample/http/http_sample_startup.sh
similarity index 100%
rename from docs/sample/http_sample_startup.sh
rename to docs/sample/http/http_sample_startup.sh
diff --git a/docs/sample/mock.md b/docs/sample/mock.md
index 50214bc..0e24231 100644
--- a/docs/sample/mock.md
+++ b/docs/sample/mock.md
@@ -38,4 +38,4 @@ curl localhost:8888/api/v1/test-dubbo/mock -X GET
 
 We plan use can config custom result in the future. Not only api config way, but also create a match rule.
 
-[Previous](./README.md)  
+[Previous](README.md)  
diff --git a/docs/sample/zh-cn/dubbo-body.md b/docs/sample/zh-cn/dubbo/dubbo-body.md
similarity index 99%
rename from docs/sample/zh-cn/dubbo-body.md
rename to docs/sample/zh-cn/dubbo/dubbo-body.md
index 68d0c79..6587845 100644
--- a/docs/sample/zh-cn/dubbo-body.md
+++ b/docs/sample/zh-cn/dubbo/dubbo-body.md
@@ -126,4 +126,4 @@ curl host:port/api/v1/test-dubbo/user2 -X PUT -d '{"name":"tc","user":{"id":"000
 true
 ```
 
-[上一页](./dubbo.md)
+[上一页](dubbo.md)
diff --git a/docs/sample/zh-cn/dubbo-mix.md b/docs/sample/zh-cn/dubbo/dubbo-mix.md
similarity index 99%
rename from docs/sample/zh-cn/dubbo-mix.md
rename to docs/sample/zh-cn/dubbo/dubbo-mix.md
index 632863c..ce40e14 100644
--- a/docs/sample/zh-cn/dubbo-mix.md
+++ b/docs/sample/zh-cn/dubbo/dubbo-mix.md
@@ -112,4 +112,4 @@ curl localhost:port/api/v1/test-dubbo/user?name=tc -X PUT -d '{"id":"0001","code
 true
 ```
 
-[上一页](./dubbo.md)
+[上一页](dubbo.md)
diff --git a/docs/sample/zh-cn/dubbo-multi.md b/docs/sample/zh-cn/dubbo/dubbo-multi.md
similarity index 99%
rename from docs/sample/zh-cn/dubbo-multi.md
rename to docs/sample/zh-cn/dubbo/dubbo-multi.md
index 809ebd3..0706f93 100644
--- a/docs/sample/zh-cn/dubbo-multi.md
+++ b/docs/sample/zh-cn/dubbo/dubbo-multi.md
@@ -201,4 +201,4 @@ and
 }
 ```
 
-[Previous](./dubbo.md)
+[Previous](dubbo.md)
diff --git a/docs/sample/zh-cn/dubbo-query.md b/docs/sample/zh-cn/dubbo/dubbo-query.md
similarity index 99%
rename from docs/sample/zh-cn/dubbo-query.md
rename to docs/sample/zh-cn/dubbo/dubbo-query.md
index 1d63348..e94ac78 100644
--- a/docs/sample/zh-cn/dubbo-query.md
+++ b/docs/sample/zh-cn/dubbo/dubbo-query.md
@@ -118,4 +118,4 @@ curl localhost:port/api/v1/test-dubbo/userByNameAndAge?name=tc&age=99 -X GET
 }
 ```
 
-[上一页](./dubbo.md)
+[上一页](dubbo.md)
diff --git a/docs/sample/zh-cn/dubbo-simple-run.md b/docs/sample/zh-cn/dubbo/dubbo-simple-run.md
similarity index 100%
rename from docs/sample/zh-cn/dubbo-simple-run.md
rename to docs/sample/zh-cn/dubbo/dubbo-simple-run.md
diff --git a/docs/sample/zh-cn/dubbo-universality.md b/docs/sample/zh-cn/dubbo/dubbo-universality.md
similarity index 99%
rename from docs/sample/zh-cn/dubbo-universality.md
rename to docs/sample/zh-cn/dubbo/dubbo-universality.md
index 8a5140d..c4ccbeb 100644
--- a/docs/sample/zh-cn/dubbo-universality.md
+++ b/docs/sample/zh-cn/dubbo/dubbo-universality.md
@@ -202,4 +202,4 @@ Dubbo 接口配置 `ReferenceConfig#InterfaceName`。
 
 请注意这种特殊情况的配置目前自由度不是很高,如果有不能满足的场景请及时反馈到[问题](https://github.com/dubbogo/dubbo-go-proxy/issues)
 
-[上一页](./dubbo.md)
+[上一页](dubbo.md)
diff --git a/docs/sample/zh-cn/dubbo-uri.md b/docs/sample/zh-cn/dubbo/dubbo-uri.md
similarity index 99%
rename from docs/sample/zh-cn/dubbo-uri.md
rename to docs/sample/zh-cn/dubbo/dubbo-uri.md
index 2a79a82..f3f6ad4 100644
--- a/docs/sample/zh-cn/dubbo-uri.md
+++ b/docs/sample/zh-cn/dubbo/dubbo-uri.md
@@ -129,4 +129,4 @@ curl localhost:port/api/v1/test-dubbo/user/name/tc/age/99 -X GET
 }
 ```
 
-[上一页](./dubbo.md)
+[上一页](dubbo.md)
diff --git a/docs/sample/zh-cn/dubbo.md b/docs/sample/zh-cn/dubbo/dubbo.md
similarity index 94%
rename from docs/sample/zh-cn/dubbo.md
rename to docs/sample/zh-cn/dubbo/dubbo.md
index 376fd19..c2c4c16 100644
--- a/docs/sample/zh-cn/dubbo.md
+++ b/docs/sample/zh-cn/dubbo/dubbo.md
@@ -12,5 +12,5 @@
 
 如何运行简单的测试例子[文档](dubbo-simple-run.md)
 
-[上一页](./README.md)
+[上一页](../README.md)