Wweiei commented on code in PR #5953:
URL: https://github.com/apache/shenyu/pull/5953#discussion_r2062572627


##########
shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/proxy/ApacheDubboProxyService.java:
##########
@@ -103,4 +108,80 @@ private CompletableFuture<Object> invokeAsync(final 
GenericService genericServic
         Object resultFromFuture = RpcContext.getContext().getFuture();
         return resultFromFuture instanceof CompletableFuture ? 
(CompletableFuture<Object>) resultFromFuture : 
CompletableFuture.completedFuture(resultFromFuture);
     }
+
+    /**
+     * get dubbo reference config.
+     *
+     * @param selectorData  the selector data
+     * @param ruleData      the rule data
+     * @param metaData      the meta data
+     * @param exchange      the webExchange
+     * @return dubbo reference config
+     */
+    private ReferenceConfig<GenericService> getReferenceConfig(final 
SelectorData selectorData, final RuleData ruleData, final MetaData metaData, 
final ServerWebExchange exchange) {
+        String referenceKey = metaData.getPath();
+        String namespace = "";
+        if 
(CollectionUtils.isNotEmpty(exchange.getRequest().getHeaders().get(Constants.NAMESPACE)))
 {
+            namespace = 
exchange.getRequest().getHeaders().get(Constants.NAMESPACE).get(0);
+        }
+
+        List<DubboUpstream> dubboUpstreams = 
GsonUtils.getInstance().fromList(selectorData.getHandle(), DubboUpstream.class);
+        dubboUpstreams = CollectionUtils.isEmpty(dubboUpstreams) ? null
+                : dubboUpstreams.stream().filter(u -> u.isStatus() && 
StringUtils.isNotBlank(u.getRegistry())).collect(Collectors.toList());
+        // if dubboUpstreams is empty, use default plugin config
+        if (CollectionUtils.isEmpty(dubboUpstreams)) {
+            referenceKey = StringUtils.isNotBlank(namespace) ? namespace + ":" 
+ referenceKey : referenceKey;

Review Comment:
   There is already a public variable for this symbol in the file 
Constants.java, and I've replaced it with that variable.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to