You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: generic/README.md
+14-13Lines changed: 14 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
-
# Generic Sample (Triple Generic Call)
1
+
# Generic Call Sample
2
2
3
3
[English](README.md) | [中文](README_zh.md)
4
4
5
-
This sample demonstrates how to use generic invocation with the Triple protocol for Go-Java interoperability. Generic invocation allows calling remote services without generating stubs or having the service interface locally.
5
+
This sample demonstrates how to use generic invocation with both Dubbo and Triple protocols for Go-Java interoperability. Generic invocation allows calling remote services without generating stubs or having the service interface locally.
6
6
7
7
## Layout
8
8
9
9
```
10
10
generic/
11
-
├── go-server/ # Go provider listening on :50052
12
-
├── go-client/ # Go consumer with generic invocation
13
-
├── java-server/ # Java provider listening on :50052
11
+
├── go-server/ # Go provider (Triple protocol, port 50052)
12
+
├── go-client/ # Go consumer with generic invocation (direct connection)
13
+
├── java-server/ # Java provider (Triple protocol, port 50052)
14
14
└── java-client/ # Java consumer with generic invocation
15
15
```
16
16
17
17
## Prerequisites
18
18
19
-
Start ZooKeeper:
19
+
Start ZooKeeper (required by the server for service registration):
20
20
21
21
```bash
22
22
docker run -d --name zookeeper -p 2181:2181 zookeeper:3.8
@@ -29,7 +29,7 @@ cd generic/go-server/cmd
29
29
go run .
30
30
```
31
31
32
-
The server listens on port `50052` and registers to ZooKeeper.
32
+
The server exposes the Triple protocol on port `50052`, registers to ZooKeeper, and serves `UserProvider` with version `1.0.0` and group `triple`.
33
33
34
34
## Run the Go Client
35
35
@@ -38,7 +38,7 @@ cd generic/go-client/cmd
38
38
go run .
39
39
```
40
40
41
-
The client discovers the service via ZooKeeper and uses `client.WithGenericType("true")` to perform generic calls.
41
+
The client uses direct URL connection (`client.WithURL`) to connect to the server and performs generic calls via `cli.NewGenericService`. It tests both Dubbo protocol (port 20000) and Triple protocol (port 50052).
42
42
43
43
## Run the Java Server
44
44
@@ -78,20 +78,21 @@ The client uses `reference.setGeneric("true")` to perform generic calls.
0 commit comments