-
Notifications
You must be signed in to change notification settings - Fork 963
Compatibility/java interop #2687
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
Conversation
|
Please run |
@@ -0,0 +1,18 @@ | |||
package dubboutil |
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.
Add apache license header for this file
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.
Added
common/rpc_service.go
Outdated
@@ -19,6 +19,7 @@ package common | |||
|
|||
import ( | |||
"context" | |||
"dubbo.apache.org/dubbo-go/v3/common/dubboutil" |
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.
pls format imports
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.
formatted
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.
LGTM.
What's the purpose of the change
1. handler mismatch
When interoperating with dubbo-java, there may be an issue when client from java side try to invoke an rpc function whose first-letter is in lower case, since dubbo-go now only provide handler whose method name is always with upper-cased first letter, due to the language feature of golang. It would cause failure in rpc function invocation, as mentioned in apache/dubbo-go-samples#771 .
To tackle this problem, a straightforward idea is to register another handler with a different first-letter case, and that's the change made by this pull request.
2. content-type codec mismatch
When using hessian2 for serialization, some version of java-side client would set a wrong content-type in request, causing marshal and unmarshal error. In order to tackle the problem, a backupCodec is introduced to handle the message in the server-side serialization type.
Validity of the solution
solution for problem 1
After adding a breakpoint at

dubbo-go/server/server.go
at line 254, which is the section that exports service , we can see the registered handlers onservice->serviceOpts->rpsService->s->triServer->handlers
, and/org.apache.dubbo.tri.hessian2.api.GreetingsService/greet
is made possible by changes in this PR.solution for problem 2
A warn message would be logged when request content-type and server serialization mismatches, and the server would try to marshal/unmarshal message in server serialization codec.
