From 819bbe31630a7fd59f8736676ff60d555ab17a17 Mon Sep 17 00:00:00 2001 From: tiecheng Date: Sun, 15 Nov 2020 21:40:58 +0800 Subject: [PATCH] add doc & change for post sample Former-commit-id: 2c0edf29d3c89ee30f695dc5c841923604555eb2 --- docs/common/README.md | 5 ++ docs/common/faq.md | 13 ++++ docs/common/proxy-arguments.md | 11 +++ docs/common/roadmap.md | 17 +++++ docs/concept.md | 29 -------- docs/developer/README.md | 6 ++ docs/developer/auto-registy.md | 7 ++ docs/developer/concept.md | 5 ++ docs/developer/filter.md | 6 ++ docs/developer/log.md | 19 ++++++ docs/index.md | 24 +++++++ docs/quick_start.md | 67 ------------------- docs/sample/README.md | 4 ++ docs/sample/dubbo-error.md | 17 +++++ docs/sample/dubbo.md | 7 ++ docs/sample/dubbogo-body.md | 51 ++++++++++++++ docs/sample/dubbogo-query.md | 49 ++++++++++++++ docs/sample/http.md | 1 + docs/user/README.md | 5 ++ .../{api_gateway_config_en.md => user/api.md} | 13 +++- docs/user/installation.md | 2 + docs/user/start.md | 16 +++++ pkg/client/dubbo/dubbo.go | 8 ++- pkg/client/dubbo/mapper.go | 20 ++++-- pkg/client/dubbo/response_test.go | 40 +++++++++++ pkg/common/constant/proxy.go | 5 ++ pkg/context/base_context.go | 7 +- pkg/filter/remote/call.go | 7 +- sample/dubbogo/proxy/api_config.yaml | 37 ++++++++-- 29 files changed, 375 insertions(+), 123 deletions(-) create mode 100644 docs/common/README.md create mode 100644 docs/common/faq.md create mode 100644 docs/common/proxy-arguments.md create mode 100644 docs/common/roadmap.md delete mode 100644 docs/concept.md create mode 100644 docs/developer/README.md create mode 100644 docs/developer/auto-registy.md create mode 100644 docs/developer/concept.md create mode 100644 docs/developer/filter.md create mode 100644 docs/developer/log.md create mode 100644 docs/index.md delete mode 100644 docs/quick_start.md create mode 100644 docs/sample/README.md create mode 100644 docs/sample/dubbo-error.md create mode 100644 docs/sample/dubbo.md create mode 100644 docs/sample/dubbogo-body.md create mode 100644 docs/sample/dubbogo-query.md create mode 100644 docs/sample/http.md create mode 100644 docs/user/README.md rename docs/{api_gateway_config_en.md => user/api.md} (95%) create mode 100644 docs/user/installation.md create mode 100644 docs/user/start.md create mode 100644 pkg/client/dubbo/response_test.go diff --git a/docs/common/README.md b/docs/common/README.md new file mode 100644 index 000000000..51276fa27 --- /dev/null +++ b/docs/common/README.md @@ -0,0 +1,5 @@ +# Common + +* [FAQ](faq.md) +* [Roadmap](roadmap.md) +* [Proxy arguments](proxy-arguments.md) \ No newline at end of file diff --git a/docs/common/faq.md b/docs/common/faq.md new file mode 100644 index 000000000..43744c433 --- /dev/null +++ b/docs/common/faq.md @@ -0,0 +1,13 @@ +# FAQ + +In case you did not find any answer here and in [closed issues](https://github.com/dubbogo/dubbo-go-proxy/issues?q=is%3Aissue+is%3Aclosed), [create new issue](https://github.com/dubbogo/dubbo-go-proxy/issues/new/choose). + +### Why first dubbogo request timeout? + +First request for dubbogo need create a GenericService, will exec ReferenceConfig.GenericLoad(), it takes some account of time. If you worry about this case, you need preheating apis for yourself. + +We plan an auto preheating in the future. + + + + \ No newline at end of file diff --git a/docs/common/proxy-arguments.md b/docs/common/proxy-arguments.md new file mode 100644 index 000000000..0733e9b9f --- /dev/null +++ b/docs/common/proxy-arguments.md @@ -0,0 +1,11 @@ +# dubbo-go-proxy arguments + +Proxy accepts multiple arguments that can be used to customize it a bit. + +## Arguments + +| Argument name | Default value | Description | +|---------------|---------------|-------------| +| -c or config | - | proxy project config, core for listener config, like port, cluster..| +|-a or api-config| - | api config, for api-gateway way's custom api | + diff --git a/docs/common/roadmap.md b/docs/common/roadmap.md new file mode 100644 index 000000000..680968f85 --- /dev/null +++ b/docs/common/roadmap.md @@ -0,0 +1,17 @@ +# Roadmap + +The following table contains a priority-ordered list of work items and features the team plans to work on. + +|Area|Item|Relative priority|Status| +|----|----|-----------------|------| +| api | basic api definition | P0 | | +| api | dubbo metadata | P0 | | +| api | http metadata | P0 | | +| auto | zookeeper registry | P1 | | +| auto | consul registry | P1 | | +| auto | kubernetes registry | P1 | | +| filter | basic filter definition | P0 | | +| plugin | go plugin | P1 | | +| client | basic client definition | P0 | | +| client | dubbo client | P0 | | +| client | http client | P0 | | diff --git a/docs/concept.md b/docs/concept.md deleted file mode 100644 index 01f64d965..000000000 --- a/docs/concept.md +++ /dev/null @@ -1,29 +0,0 @@ -# 术语 - -## 组件 -### Proxy -数据面板 -###Admin -控制面板 - -## 概念 -### 下游(Downstream) -下游主机连接到 Proxy ,发送请求并接收响应。(API 网关场景理解:浏览器) -### 上游(Upstream) -上游主机接收来自 Proxy 的连接和请求并返回响应。(API 网关场景理解:dubbo 服务的机器) -### 监听器(Listener) -监听器是可以被下游客户端连接的网络位置(例如,端口,unix域套接字等)。Proxy 公开一个或多个下游主机连接的监听器。 -### 集群(Cluster) -群集是指 Proxy 连接到的一组逻辑上相似的上游主机(比如 dubbo 集群)。Proxy 通过服务发现发现一个集群的成员,它可以通过主动健康检查来确定集群成员的健康度,从而 Proxy 通过负载均衡策略将请求路由到相应的集群成员。 -### 接口(Api) -接口是 API 网关的核心概念,特别针对浏览器等外部系统的访问时必须开启,所有请求必须匹配到对应的 Up 状态的接口才能继续进行后续逻辑。 -### 客户端(Client) -请求上游主机的真实调用对象。 -### 路由(Router) -路由策略,目前理解成 HTTP 路由,通过 match 逻辑路由到对应的集群。 -### 上下文(Context) -一个真实请求的上下文,包含这次请求几乎所有的信息。在各个环节都会使用,特别是 filter 链路。 -### 过滤器(Filter) -过滤器,提供拦截能力。支持自定义扩展。 -### 规则(Rule) -规则提供匹配能力,给过滤器,路由等其它概念使用。 \ No newline at end of file diff --git a/docs/developer/README.md b/docs/developer/README.md new file mode 100644 index 000000000..d66580442 --- /dev/null +++ b/docs/developer/README.md @@ -0,0 +1,6 @@ +# Developer Guide + +* [Concept](concept.md) +* [Auto Registry](auto-registy.md) +* [Filter](filter.md) +* [Log](log.md) \ No newline at end of file diff --git a/docs/developer/auto-registy.md b/docs/developer/auto-registy.md new file mode 100644 index 000000000..70ac343a1 --- /dev/null +++ b/docs/developer/auto-registy.md @@ -0,0 +1,7 @@ +# Auto Registry + +A feature easy for users to use dubbo-go-proxy. + +## dubbo + +Find dubbo rpc interface from dubbo's register, use rules to significantly reduces the amount of manual registration. This feature is doing. \ No newline at end of file diff --git a/docs/developer/concept.md b/docs/developer/concept.md new file mode 100644 index 000000000..708d02e25 --- /dev/null +++ b/docs/developer/concept.md @@ -0,0 +1,5 @@ +# Concept + +## Term + +the term in dubbo-go-proxy diff --git a/docs/developer/filter.md b/docs/developer/filter.md new file mode 100644 index 000000000..e296b39ee --- /dev/null +++ b/docs/developer/filter.md @@ -0,0 +1,6 @@ +# Filter + +Filter is the composition of filter chain, make use more control. + +## Default filter + diff --git a/docs/developer/log.md b/docs/developer/log.md new file mode 100644 index 000000000..8a5207305 --- /dev/null +++ b/docs/developer/log.md @@ -0,0 +1,19 @@ +# Log + +How to view logs in dubbo-go-proxy. + +## DEBUG log + +** dubbo 请求日志** + +```bash +2020-11-14T20:59:58.841+0800 DEBUG dubbo/dubbo.go:149 [dubbo-go-proxy] invoke, method:GetUserByName, types:[java.lang.String], reqData:[tc] +``` + +** dubbo 响应日志** + +```bash +2020-11-14T20:59:58.843+0800 DEBUG remote/call.go:96 [dubbo-go-proxy] resp : {map[age:18 i_d:0001 name:tc]} +``` + + diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 000000000..75fdfaeb3 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,24 @@ +# dubbo-go-proxy Documentation + +## [Common](common/README.md) + +* [FAQ](common/faq.md) +* [Roadmap](common/roadmap.md) +* [Proxy arguments](common/proxy-arguments.md) + +## [Samples](sample/README.md) + +* [dubbo](sample/dubbo.md) +* [http](sample/http.md) + +## [User Guide](user/README.md) + +* [Api Model](user/api.md) +* [Installation](user/installation.md) + +## [Developer Guide](developer/README.md) + +* [Concept](developer/concept.md) +* [Auto Registry](developer/auto-registy.md) +* [Filter](developer/filter.md) +* [Log](developer/log.md) \ No newline at end of file diff --git a/docs/quick_start.md b/docs/quick_start.md deleted file mode 100644 index c62488f3c..000000000 --- a/docs/quick_start.md +++ /dev/null @@ -1,67 +0,0 @@ -目前在内部测试中,仅供开发人员使用 - -先提两个点: - -#### 配置文件 -- aproxy/configs/client.yml 项目配置 -- aproxy/configs/api_config.yaml 里面是Api配置 - -另外两个配置文件是 dubbo 的,考虑把必要的参数整到 client.yml 的 dgp.filters.remote_call 这个 filter 的配置里面 - -因为现在没有接口配置,暂时接口配置写死在代码 - -> API 配置 - -proxy_start.go#beforeStart() 里面配一些自己的 dubbo 接口元数据 - -#### IDE启动 - -启动类 cmd/proxy/proxy.go - -程序参数 --c /Users/tc/Documents/workspace_2020/aproxy/configs/conf.yaml - -环境变量 -CONF_CONSUMER_FILE_PATH=/Users/tc/Documents/workspace_2020/aproxy/configs/client.yml;APP_LOG_CONF_FILE=/Users/tc/Documents/workspace_2020/aproxy/configs/log.yml - -### sample - -#### 发送单参数请求 - -> 请求头 X-DGP-WAY:dubbo,和配置文件对应 - -url: http://127.0.0.1:8888/api/v1/test-dubbo/getUserByName - -body: -```json -"tiecheng" -``` - -response: -```json -{ - "id": "3213", - "name": "tiecheng", - "age": 25 -} -``` - -url: http://127.0.0.1:8888/api/v1/test-dubbo/user - -body: -```json -{ - "id": "3213", - "name": "tiecheng", - "age": 25 -} -``` - -response: -```json -{ - "age": 25, - "id": "3213", - "name": "tiecheng" -} -``` \ No newline at end of file diff --git a/docs/sample/README.md b/docs/sample/README.md new file mode 100644 index 000000000..653224665 --- /dev/null +++ b/docs/sample/README.md @@ -0,0 +1,4 @@ +# Samples + +* [dubbo](sample/dubbo.md) +* [http](sample/http.md) \ No newline at end of file diff --git a/docs/sample/dubbo-error.md b/docs/sample/dubbo-error.md new file mode 100644 index 000000000..44a6fe1ae --- /dev/null +++ b/docs/sample/dubbo-error.md @@ -0,0 +1,17 @@ +# dubbo error + +err log in proxy + +```bash +2020-11-14T17:56:58.652+0800 ERROR remote/call.go:89 [dubboproxy go] client do err:data is exist! +github.com/dubbogo/dubbo-go-proxy/pkg/logger.Errorf + /Users/tc/Documents/workspace_2020/dubbo-go-proxy/pkg/logger/logging.go:52 +github.com/dubbogo/dubbo-go-proxy/pkg/filter/remote.(*clientFilter).doRemoteCall + /Users/tc/Documents/workspace_2020/dubbo-go-proxy/pkg/filter/remote/call.go:89 +github.com/dubbogo/dubbo-go-proxy/pkg/filter/remote.(*clientFilter).Do.func1 + /Users/tc/Documents/workspace_2020/dubbo-go-proxy/pkg/filter/remote/call.go:66 +github.com/dubbogo/dubbo-go-proxy/pkg/context/http.(*HttpContext).Next + /Users/tc/Documents/workspace_2020/dubbo-go-proxy/pkg/context/http/context.go:54 +github.com/dubbogo/dubbo-go-proxy/pkg/filter/timeout.(*timeoutFilter).Do.func1.1 + /Users/tc/Documents/workspace_2020/dubbo-go-proxy/pkg/filter/timeout/timeout.go:74 +``` \ No newline at end of file diff --git a/docs/sample/dubbo.md b/docs/sample/dubbo.md new file mode 100644 index 000000000..9da66541c --- /dev/null +++ b/docs/sample/dubbo.md @@ -0,0 +1,7 @@ +# dubbo + +* [dubbo-query](dubbogo-query.md) +* [dubbo-body](dubbogo-body.md) +* [dubbo-error](dubbo-error.md) + + diff --git a/docs/sample/dubbogo-body.md b/docs/sample/dubbogo-body.md new file mode 100644 index 000000000..10b76e3ba --- /dev/null +++ b/docs/sample/dubbogo-body.md @@ -0,0 +1,51 @@ +# Get the parameter from the body + +> POST request + +## passthrough + +**config** + +```yaml +name: proxy +description: proxy sample +resources: + - path: '/api/v1/test-dubbo/user' + type: restful + description: user + methods: + - httpVerb: POST + onAir: true + timeout: 10s + inboundRequest: + requestType: http + integrationRequest: + requestType: dubbo + mappingParams: + - name: requestBody._all + mapTo: 0 + applicationName: "UserProvider" + interface: "com.ic.user.UserProvider" + method: "CreateUser" + paramTypes: [ "com.ikurento.user.User" ] + group: "test" + version: 1.0.0 + clusterName: "test_dubbo" +``` + +**request** + +```bash +curl localhost:8888/api/v1/test-dubbo/user -X POST -d '{"name":"tiecheng","id":"0001","age":18}' --header "Content-Type: application/json" +``` + +**response** + +```bash +{"age":18,"i_d":"0001","name":"tiecheng"} +``` + +## mapping + + + diff --git a/docs/sample/dubbogo-query.md b/docs/sample/dubbogo-query.md new file mode 100644 index 000000000..a196f66c5 --- /dev/null +++ b/docs/sample/dubbogo-query.md @@ -0,0 +1,49 @@ +# Get the parameter from the query + +> GET request + +## simple + +**config** + +```yaml +name: proxy +description: proxy sample +resources: + - path: '/api/v1/test-dubbo/user' + type: restful + description: user + methods: + - httpVerb: GET + onAir: true + timeout: 100ms + inboundRequest: + requestType: http + queryStrings: + - name: name + required: true + integrationRequest: + requestType: dubbo + mappingParams: + - name: queryStrings.name + mapTo: 0 + applicationName: "UserProvider" + interface: "com.ic.user.UserProvider" + method: "GetUserByName" + paramTypes: [ "java.lang.String" ] + group: "test" + version: 1.0.0 + clusterName: "test_dubbo" +``` + +**request** + +```bash +curl localhost:8888/api/v1/test-dubbo/user?name=tc -X GET +``` + +**response** + +```bash +{"age":18,"i_d":"0001","name":"tc"} +``` \ No newline at end of file diff --git a/docs/sample/http.md b/docs/sample/http.md new file mode 100644 index 000000000..08154d895 --- /dev/null +++ b/docs/sample/http.md @@ -0,0 +1 @@ +# http \ No newline at end of file diff --git a/docs/user/README.md b/docs/user/README.md new file mode 100644 index 000000000..59cd00f98 --- /dev/null +++ b/docs/user/README.md @@ -0,0 +1,5 @@ +# User Guide + +* [Quick Start](start.md) +* [Api Model](api.md) +* [Installation](installation.md) \ No newline at end of file diff --git a/docs/api_gateway_config_en.md b/docs/user/api.md similarity index 95% rename from docs/api_gateway_config_en.md rename to docs/user/api.md index 0673f66d3..b9ba1d5fc 100644 --- a/docs/api_gateway_config_en.md +++ b/docs/user/api.md @@ -1,6 +1,13 @@ -# API Gateway -API is the key feature of the dubbo-go-proxy. With this feature, you can expose your dubbo service as a HTTP service. -## Configuration +# Api + +Introduction to API model, recommended reading before customizing API for api_config.yaml. + +## Api Gateway + +API is the key feature of the dubbo-go-proxy. With this feature, you can expose your dubbo service as an HTTP service. + +### Configuration + Sample: ``` yaml name: api name diff --git a/docs/user/installation.md b/docs/user/installation.md new file mode 100644 index 000000000..4026317a8 --- /dev/null +++ b/docs/user/installation.md @@ -0,0 +1,2 @@ +# Installation + diff --git a/docs/user/start.md b/docs/user/start.md new file mode 100644 index 000000000..d91c6482a --- /dev/null +++ b/docs/user/start.md @@ -0,0 +1,16 @@ +# Start + +How to start the dubbo-go-proxy + +## intellij + +**main** + +cmd/proxy/proxy.go + +**config program arguments** + +```bash +-c /path/dubbo-go-proxy/sample/dubbogo/proxy/conf.yaml -a /path/dubbo-go-proxy/sample/dubbogo/proxy/api_config.yaml +``` + diff --git a/pkg/client/dubbo/dubbo.go b/pkg/client/dubbo/dubbo.go index 69dc84400..a5c341a57 100644 --- a/pkg/client/dubbo/dubbo.go +++ b/pkg/client/dubbo/dubbo.go @@ -141,8 +141,12 @@ func (dc *Client) Close() error { func (dc *Client) Call(req *client.Request) (resp client.Response, err error) { dm := req.API.Method.IntegrationRequest types, values, err := dc.MappingParams(req) + if err != nil { + return *client.EmptyResponse, err + } + method := dm.Method - logger.Debugf("[dubbogo proxy] invoke, method:%s, types:%s, reqData:%v", method, types, values) + logger.Debugf("[dubbo-go-proxy] invoke, method:%s, types:%s, reqData:%v", method, types, values) gs := dc.Get(dm) @@ -152,7 +156,7 @@ func (dc *Client) Call(req *client.Request) (resp client.Response, err error) { return *client.EmptyResponse, err } - logger.Debugf("[dubbogo proxy] dubbo client resp:%v", rst) + logger.Debugf("[dubbo-go-proxy] dubbo client resp:%v", rst) if rst == nil { return client.Response{}, nil diff --git a/pkg/client/dubbo/mapper.go b/pkg/client/dubbo/mapper.go index baeb7d242..27a293757 100644 --- a/pkg/client/dubbo/mapper.go +++ b/pkg/client/dubbo/mapper.go @@ -18,6 +18,10 @@ package dubbo import ( + "bytes" + "encoding/json" + "io/ioutil" + "reflect" "strconv" ) @@ -26,11 +30,9 @@ import ( ) import ( - "encoding/json" "github.com/dubbogo/dubbo-go-proxy/pkg/client" + "github.com/dubbogo/dubbo-go-proxy/pkg/common/constant" "github.com/dubbogo/dubbo-go-proxy/pkg/config" - "io/ioutil" - "reflect" ) type queryStringsMapper struct{} @@ -95,23 +97,27 @@ func (bm bodyMapper) Map(mp config.MappingParam, c client.Request, target interf return errors.Errorf("Parameter mapping %v incorrect", mp) } - body, err := c.IngressRequest.GetBody() + rawBody, err := ioutil.ReadAll(c.IngressRequest.Body) if err != nil { return err } - rawBody, err := ioutil.ReadAll(body) + mapBody := map[string]interface{}{} + err = json.Unmarshal(rawBody, &mapBody) if err != nil { return err } - mapBody := map[string]interface{}{} - json.Unmarshal(rawBody, &mapBody) + val, err := getMapValue(mapBody, keys) setTarget(rv, pos, val) + c.IngressRequest.Body = ioutil.NopCloser(bytes.NewBuffer(rawBody)) return nil } func getMapValue(sourceMap map[string]interface{}, keys []string) (interface{}, error) { + if len(keys) == 1 && keys[0] == constant.DefaultBodyAll { + return sourceMap, nil + } for i, key := range keys { _, ok := sourceMap[key] if !ok { diff --git a/pkg/client/dubbo/response_test.go b/pkg/client/dubbo/response_test.go new file mode 100644 index 000000000..9fb1af3ba --- /dev/null +++ b/pkg/client/dubbo/response_test.go @@ -0,0 +1,40 @@ +/* + * 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 dubbo + +import ( + "testing" +) + +import ( + "github.com/stretchr/testify/assert" +) + +func TestNewDubboResponse(t *testing.T) { + resp := map[string]interface{}{ + "age": 18, + "iD": 0001, + "name": "tc", + "time": nil, + } + result := NewDubboResponse(resp) + r := result.Data.(map[string]interface{}) + assert.Equal(t, 18, r["age"]) + assert.Equal(t, 1, r["i_d"]) + assert.Equal(t, "tc", r["name"]) +} diff --git a/pkg/common/constant/proxy.go b/pkg/common/constant/proxy.go index 129111bb8..b946abc2c 100644 --- a/pkg/common/constant/proxy.go +++ b/pkg/common/constant/proxy.go @@ -24,3 +24,8 @@ const ( DefaultTimeoutStr = "1s" DefaultTimeout = time.Second ) + +// body passthrough +const ( + DefaultBodyAll = "_all" +) diff --git a/pkg/context/base_context.go b/pkg/context/base_context.go index eb1cf0f63..329444057 100644 --- a/pkg/context/base_context.go +++ b/pkg/context/base_context.go @@ -23,10 +23,6 @@ import ( "time" ) -import ( - "github.com/dubbogo/dubbo-go-proxy/pkg/logger" -) - const abortIndex int8 = math.MaxInt8 / 2 // BaseContext @@ -61,8 +57,7 @@ func (c *BaseContext) Abort() { // AbortWithError filter chain break , filter after the current filter will not executed. And log will print. func (c *BaseContext) AbortWithError(message string, err error) { - c.Index = abortIndex - logger.Errorf("abort with err : %v", err) + c.Abort() } // AppendFilterFunc append filter func. diff --git a/pkg/filter/remote/call.go b/pkg/filter/remote/call.go index afe83a1d9..ec2815973 100644 --- a/pkg/filter/remote/call.go +++ b/pkg/filter/remote/call.go @@ -86,13 +86,12 @@ func (f *clientFilter) doRemoteCall(c *contexthttp.HttpContext) { resp, err := cli.Call(client.NewReq(c.Ctx, c.Request, *api)) if err != nil { - logger.Errorf("[dubboproxy go] client do err:%v!", err) - c.WriteWithStatus(http.StatusServiceUnavailable, constant.Default503Body) - c.AddHeader(constant.HeaderKeyContextType, constant.HeaderValueTextPlain) + logger.Errorf("[dubbo-go-proxy go] client do err:%v!", err) + c.WriteErr(err) return } - logger.Debugf("resp : %v", resp) + logger.Debugf("[dubbo-go-proxy go] : %v", resp) c.WriteResponse(resp) c.Next() diff --git a/sample/dubbogo/proxy/api_config.yaml b/sample/dubbogo/proxy/api_config.yaml index 782865d70..d56bf1c45 100644 --- a/sample/dubbogo/proxy/api_config.yaml +++ b/sample/dubbogo/proxy/api_config.yaml @@ -30,21 +30,23 @@ resources: clusterName: "test_dubbo" - httpVerb: POST onAir: true + timeout: 10s inboundRequest: requestType: http - requestBody: - - definitionName: "com.ikurento.user.User" +# requestBody: +# - definitionName: "userCreate" integrationRequest: requestType: dubbo mappingParams: - - name: requestBody - mapTo: 1 + - name: requestBody._all + mapTo: 0 applicationName: "UserProvider" interface: "com.ic.user.UserProvider" method: "CreateUser" - clusterName: "test_dubbo" + paramTypes: [ "com.ikurento.user.User" ] group: "test" version: 1.0.0 + clusterName: "test_dubbo" - path: '/api/v1/test-dubbo/timeout-user' type: restful description: user @@ -71,6 +73,31 @@ resources: group: "test" version: 1.0.0 clusterName: "test_dubbo" + - path: '/api/v1/test-dubbo/user-add' + type: restful + description: user + methods: + - httpVerb: POST + onAir: true + timeout: 10s + inboundRequest: + requestType: http + integrationRequest: + requestType: dubbo + mappingParams: + - name: requestBody.name + mapTo: 0 + - name: requestBody.id + mapTo: 1 + - name: requestBody.age + mapTo: 2 + applicationName: "UserProvider" + interface: "com.ic.user.UserProvider" + method: "CreateUser" + paramTypes: [ "com.ikurento.user.User" ] + group: "test" + version: 1.0.0 + clusterName: "test_dubbo" definitions: - name: userCreate schema: >-