-
Notifications
You must be signed in to change notification settings - Fork 225
feat(generic): add generic call sample for both Dubbo and Triple protocols #1016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
9babfa4 to
da7f82d
Compare
|
9fe8d23 to
3e4db86
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the generic call sample to demonstrate both Dubbo and Triple protocol generic calls between Go and Java. The refactoring includes dual protocol support, project structure simplification, and a comprehensive test suite with 19 test cases.
Changes:
- Added dual protocol support (Dubbo on port 20000 and Triple on port 50052) with separate service groups
- Refactored project structure by removing redundant nested directories (java-server/java-server → java-server)
- Added comprehensive test coverage with 19 test cases and 2 benchmarks for generic calls
- Changed QueryUsers signature from List to User[] for consistency
Reviewed changes
Copilot reviewed 30 out of 38 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Added local replace directive for dubbo-go dependency (temporary) |
| generic/java-server/src/main/java/org/apache/dubbo/samples/ApiProvider.java | New dual protocol server implementation |
| generic/java-server/src/main/java/org/apache/dubbo/samples/User.java | Added User POJO class |
| generic/java-server/src/main/java/org/apache/dubbo/samples/Gender.java | Added Gender enum |
| generic/java-server/src/main/java/org/apache/dubbo/samples/UserProvider.java | Changed QueryUsers from List to array |
| generic/java-server/src/main/java/org/apache/dubbo/samples/UserProviderImpl.java | Updated QueryUsers implementation |
| generic/java-client/src/main/java/org/apache/dubbo/samples/ApiTripleConsumer.java | New Triple protocol consumer |
| generic/java-client/pom.xml | New client pom configuration |
| generic/go-server/cmd/server.go | Simplified server implementation |
| generic/go-server/pkg/user_provider.go | Added Invoke method for generic calls |
| generic/go-client/cmd/client.go | Refactored to test both protocols |
| generic/go-client/cmd/client_test.go | Added comprehensive test suite |
| generic/README.md | Updated documentation |
| generic/README_zh.md | Updated Chinese documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) | ||
|
|
||
| replace ( | ||
| dubbo.apache.org/dubbo-go/v3 => ../dubbo-go |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The local replace directive points to a relative path '../dubbo-go' which is a temporary development dependency. This should be removed before merging to production. The PR description mentions this depends on apache/dubbo-go#3154, so this replace directive should only be present during development/testing and removed once that PR is merged.
| 启动 ZooKeeper: | ||
|
|
||
| - Docker 和 Docker Compose 用于运行 ZooKeeper 注册中心 | ||
| - Go 1.23+ 用于 Dubbo-Go 示例 | ||
| - Java 8+ 和 Maven 用于 Dubbo Java 示例 | ||
| ```bash | ||
| docker run -d --name zookeeper -p 2181:2181 zookeeper:3.8 | ||
| ``` |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Chinese README also includes ZooKeeper setup instructions in the Prerequisites section, which is inconsistent with the direct connection approach described in the PR. This section should be updated to match the removal of ZooKeeper dependency.
|
Please fix the ci failure and review the copilot's comment. |
|
这个ci fail只能等dubbogo发新tag才能解决 |
| ) | ||
|
|
||
| replace ( | ||
| dubbo.apache.org/dubbo-go/v3 => ../dubbo-go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个replace不要上传
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个我等一下改一下,我把copliot提的那些问题修复一下吧
5c643ce to
5c4a941
Compare
…ocols This PR refactors and enhances the generic call sample to demonstrate both Dubbo protocol and Triple protocol generic calls between Go and Java. ## Changes Overview ### 1. Dual Protocol Support | Protocol | Port | Group | Description | |----------|-------|----------|----------------------------------| | Dubbo | 20000 | `dubbo` | Traditional Dubbo binary protocol| | Triple | 50052 | `triple` | HTTP/2 based Triple protocol | ### 2. Direct Connection Mode - Removed ZooKeeper dependency in favor of direct URL connection - Simplifies local testing and CI/CD pipelines - No external dependencies required to run the sample ### 3. Project Structure Simplification - Removed redundant nested directories (java-server/java-server → java-server) - Added run.sh scripts for easy execution ### 4. Comprehensive Test Suite Added client_test.go with test cases covering: - Dubbo Protocol Tests (6 cases) - Triple Protocol Tests (13 cases) - Benchmarks for both protocols ### 5. Code Improvements - Go server uses direct connection mode (no registry) - user_provider.go Invoke method returns proper error for unknown methods - Fixed QueryUsers parameter type to match Java array signature ## Dependencies This PR depends on apache/dubbo-go#3154 which adds `NewGenericService` API. CI will pass after that PR is merged to main branch. Signed-off-by: TsukiKage <[email protected]>
5c4a941 to
5d068dd
Compare
What this PR does
This PR refactors and enhances the generic call sample to demonstrate both Dubbo protocol and Triple protocol generic calls between Go and Java.
Background
The existing generic sample only demonstrated Dubbo protocol generic call. With the new Triple protocol generic call support in dubbo-go (see apache/dubbo-go#3154), this sample needs to be updated to showcase both protocols.
Changes Overview
1. Dual Protocol Support
The sample now demonstrates generic call on both protocols:
dubbotriple2. Java Server Enhancement
Before: Single protocol, ZooKeeper dependency
After: Dual protocol, direct connection mode
3. Go Client Enhancement
Before: Only Dubbo protocol test
After: Tests both Dubbo and Triple protocols using new
GenericServiceAPI4. Comprehensive Test Suite
Added
client_test.gowith 19 test cases:Dubbo Protocol Tests (6 cases):
TestDubboGenericCall_StringArgTestDubboGenericCall_MultipleArgsTestDubboGenericCall_IntArgTestDubboGenericCall_NoArgsTestDubboGenericCall_ArrayArgTestDubboGenericCall_POJOArgTriple Protocol Tests (13 cases):
TestTripleGenericCall_StringArgTestTripleGenericCall_MultipleArgsTestTripleGenericCall_IntArgTestTripleGenericCall_NoArgsTestTripleGenericCall_ArrayArgTestTripleGenericCall_POJOArgTestTripleGenericCall_POJOArrayArgTestTripleGenericCall_MapResultTestTripleGenericCall_ListResultTestTripleGenericCall_EmptyArrayArgTestTripleGenericCall_NonExistentMethodTestTripleGenericCall_WithTimeoutTestTripleGenericCall_WithCancelledContextBenchmarks:
BenchmarkDubboGenericCallBenchmarkTripleGenericCall5. Project Structure Simplification
Before (nested directories):
After (flat structure):
6. Removed ZooKeeper Dependency
Files Changed
generic/java-server/src/.../ApiProvider.javageneric/java-client/src/.../ApiTripleConsumer.javageneric/go-client/cmd/client.gogeneric/go-client/cmd/client_test.gogeneric/go-server/cmd/server.gogeneric/go-server/pkg/user_provider.gogeneric/java-server/run.shgeneric/java-client/run.shgeneric/README.mdgeneric/README_zh.mdgeneric/java-*/java-*/generic/build/test.shHow to Test
1. Start Java Server
cd generic/java-server ./run.sh2. Run Go Client Tests
3. Or Run Go Client Manually
cd generic/go-client/cmd go run client.goTest Results
Related PRs
Signed-off-by: TsukiKage [email protected]