-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
triple invoke support callback&future #1249
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1249 +/- ##
============================================
- Coverage 72.21% 71.95% -0.27%
+ Complexity 782 780 -2
============================================
Files 412 413 +1
Lines 17467 17555 +88
Branches 2723 2739 +16
============================================
+ Hits 12614 12631 +17
- Misses 3466 3531 +65
- Partials 1387 1393 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
.../remoting-triple/src/main/java/com/alipay/sofa/rpc/transport/triple/TripleClientInvoker.java
Outdated
Show resolved
Hide resolved
.../remoting-triple/src/main/java/com/alipay/sofa/rpc/transport/triple/TripleClientInvoker.java
Outdated
Show resolved
Hide resolved
...emoting-triple/src/main/java/com/alipay/sofa/rpc/transport/triple/TripleClientTransport.java
Outdated
Show resolved
Hide resolved
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
.../remoting-triple/src/main/java/com/alipay/sofa/rpc/transport/triple/TripleClientInvoker.java
Outdated
Show resolved
Hide resolved
.../remoting-triple/src/main/java/com/alipay/sofa/rpc/transport/triple/TripleClientInvoker.java
Outdated
Show resolved
Hide resolved
… into triple-callback
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
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
背景
目前SOFA-RPC的triple协议不支持callback调用,该RP预期增加该能力
实现思路
整体上希望基于gRPC本身的Observer机制实现,如下:
用户在使用callback方式时,仍旧按照现有的编程界面,设置callbackhandler且仍然按照同步方法发起调用
当用户设置callback时,请求会到TripleClientTransport中的asyncSend方法,这里实现方案仿造syncSend方法,把请求交给TripleInvoker的asyncInvoke方法
在TripleInvoker的asyncInvoke中做了方法切换,比如用户调用的是test(request)方法,这里会转换成调test(request, StreamObserver)方法,然后让StreamObserver的实现是调用用户设置的callbackhandler
其他
请首先评估一下上述实现思路是否合理,如果合适的话再补充测试用例