-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
Broadcast mode supports the collection of service response sent by ev… #7645
Conversation
915d08f
to
64cda74
Compare
for (Invoker<T> invoker : invokers) { | ||
BroadcastResult br = new BroadcastResult(); |
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.
How about only build such result when enable aggerate result?
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.
get
@@ -100,7 +134,7 @@ public Result doInvoke(final Invocation invocation, List<Invoker<T>> invokers, L | |||
} | |||
throw exception; | |||
} | |||
|
|||
result.setAttachment(BROADCAST_RESULTS_KEY, new Gson().toJson(resultList)); |
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.
was this necessary?
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.
yes
package org.apache.dubbo.rpc.cluster.support; | ||
|
||
/** | ||
* @Author [email protected] |
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 remove author tag, thx
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.
get
also, pls add some ut for this pr |
Codecov Report
@@ Coverage Diff @@
## master #7645 +/- ##
============================================
- Coverage 59.13% 59.06% -0.07%
+ Complexity 530 529 -1
============================================
Files 1076 1079 +3
Lines 43439 43627 +188
Branches 6351 6369 +18
============================================
+ Hits 25689 25770 +81
- Misses 14913 14996 +83
- Partials 2837 2861 +24 Continue to review full report at Codecov.
|
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.
@@ -55,6 +62,7 @@ public Result doInvoke(final Invocation invocation, List<Invoker<T>> invokers, L | |||
// 100 means that an exception will be thrown last, and 0 means that as long as an exception occurs, it will be thrown. | |||
// see https://github.com/apache/dubbo/pull/7174 | |||
int broadcastFailPercent = url.getParameter(BROADCAST_FAIL_PERCENT_KEY, MAX_BROADCAST_FAIL_PERCENT); | |||
boolean collectAllResults = url.getParameter(BROADCAST_COLLECT_ALL_RESULT_KEY, false); |
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.
Please add some comment about this parameter
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.
get
Please improve the related document ( about usage and scenes to be used ) in dubbo-website after this PR merged. |
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
get |
baba5f3
to
1fac10f
Compare
if (hasException(res.exception)) { | ||
return createResult(invocation, res.exception, res.resultList); | ||
} | ||
Result result = res.resultList.get(0).getResult(); |
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.
why not use getter
also will this produce npe?
…ery dubbo provider.
For instance, a dubbo consumer broadcasts a call to every dubbo provider's health check api. The BroadcastClusterInvoker will collect the response of every one of these providers.