Skip to content

Commit b4087e3

Browse files
authored
docs: update dubbo-proxy doc (#10822)
1 parent 9792312 commit b4087e3

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

docs/en/latest/plugins/dubbo-proxy.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,45 @@ curl http://127.0.0.1:9180/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f1
9393

9494
You can follow the [Quick Start](https://github.com/alibaba/tengine/tree/master/modules/mod_dubbo#quick-start) guide in Tengine with the configuration above for testing.
9595

96-
Dubbo returns data in the form `Map<String, String>`.
96+
APISIX dubbo plugin uses `hessian2` as the serialization protocol. It supports only `Map<String, Object>` as the request and response data type.
97+
98+
### Application
99+
100+
Your dubbo config should be configured to use `hessian2` as the serialization protocol.
101+
102+
```yml
103+
dubbo:
104+
...
105+
protocol:
106+
...
107+
serialization: hessian2
108+
```
109+
110+
Your application should implement the interface with the request and response data type as `Map<String, Object>`.
111+
112+
```java
113+
public interface DemoService {
114+
Map<String, Object> sayHello(Map<String, Object> context);
115+
}
116+
```
117+
118+
### Request and Response
119+
120+
If you need to pass request data, you can add the data to the HTTP request header. The plugin will convert the HTTP request header to the request data of the Dubbo service. Here is a sample HTTP request that passes `user` information:
121+
122+
```bash
123+
curl -i -X POST 'http://localhost:9080/hello' \
124+
--header 'user: apisix'
125+
126+
127+
HTTP/1.1 200 OK
128+
Date: Mon, 15 Jan 2024 10:15:57 GMT
129+
Content-Type: text/plain; charset=utf-8
130+
...
131+
hello: apisix
132+
...
133+
Server: APISIX/3.8.0
134+
```
97135

98136
If the returned data is:
99137

0 commit comments

Comments
 (0)