Skip to content

Commit

Permalink
Merge pull request #276 from MasterKenway/docs/grpc
Browse files Browse the repository at this point in the history
  • Loading branch information
mark4z committed Oct 12, 2021
2 parents 516c82b + cc0c57c commit 7234723
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 84 deletions.
85 changes: 53 additions & 32 deletions docs/sample/http/http-grpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,63 @@

> Doc metions below fit the code in the `samples/http/grpc`
## Define Apis in the pixiu/api_config.yaml
## Define Pixiu Config

```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"
static_resources:
listeners:
- name: "net/http"
address:
socket_address:
protocol_type: "HTTP"
address: "0.0.0.0"
port: 8881
filter_chains:
- filter_chain_match:
domains:
- api.dubbo.com
- api.pixiu.com
filters:
- name: dgp.filter.httpconnectionmanager
config:
route_config:
routes:
- match:
prefix: "/api/v1"
route:
cluster: "test-grpc"
cluster_not_found_response_code: 505
http_filters:
- name: dgp.filter.http.grpcproxy
config:
path: /mnt/d/WorkSpace/GoLandProjects/dubbo-go-pixiu/samples/http/grpc/proto
- name: dgp.filter.http.response
config:
server_name: "test-http-grpc"
generate_request_id: false
config:
idle_timeout: 5s
read_timeout: 5s
write_timeout: 5s
clusters:
- name: "test-grpc"
lb_policy: "RoundRobin"
endpoints:
- socket_address:
address: 127.0.0.1
port: 50001
protocol_type: "GRPC"
timeout_config:
connect_timeout: "5s"
request_timeout: "10s"
shutdown_config:
timeout: "60s"
step_timeout: "10s"
reject_policy: "immediacy"
```

> Grpc server is defined in the `clusters`
> WARN: currently http request only support json body to parse params
## Prepare for the Server
Expand Down
49 changes: 0 additions & 49 deletions samples/http/grpc/pixiu/api_config.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions samples/http/grpc/pixiu/conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ static_resources:
cluster: "test-grpc"
cluster_not_found_response_code: 505
http_filters:
- name: dgp.filter.http.apiconfig
config:
path: $PROJECT_DIR/pixiu/api_config.yaml
- name: dgp.filter.http.grpcproxy
config:
path: $PROJECT_DIR/proto
Expand Down

0 comments on commit 7234723

Please sign in to comment.