Exemplo n.º 1
0
 public static List<Provider> route(
     String serviceName,
     String consumerAddress,
     String consumerQueryUrl,
     List<Provider> providers,
     List<Override> overrides,
     List<Route> routes,
     Map<String, List<String>> clusters,
     List<Route> routed) {
   if (providers == null) {
     return null;
   }
   Map<String, String> urls = new HashMap<String, String>();
   urls.put(
       "consumer://" + consumerAddress + "/" + serviceName,
       consumerQueryUrl); // not empty dummy data
   for (Provider provider : providers) {
     if (com.alibaba.dubbo.governance.web.common.pulltool.Tool.isProviderEnabled(
         provider, overrides)) {
       urls.put(provider.getUrl(), provider.getParameters());
     }
   }
   urls =
       RouteUtils.route(
           serviceName, consumerAddress, consumerQueryUrl, urls, routes, clusters, routed);
   List<Provider> result = new ArrayList<Provider>();
   for (Provider provider : providers) {
     if (urls.containsKey(provider.getUrl())) {
       result.add(provider);
     }
   }
   return result;
 }
Exemplo n.º 2
0
 /** @return Map<methodName, Route> */
 public static List<Route> findUsedRoute(
     String serviceName,
     String consumerAddress,
     String consumerQueryUrl,
     List<Route> routes,
     Map<String, List<String>> clusters) {
   List<Route> routed = new ArrayList<Route>();
   Map<String, String> urls = new HashMap<String, String>();
   urls.put("dubbo://" + consumerAddress + "/" + serviceName, consumerQueryUrl);
   RouteUtils.route(
       serviceName, consumerAddress, consumerQueryUrl, urls, routes, clusters, routed);
   return routed;
 }