Java Code Examples for com.alibaba.dubbo.registry.common.domain.Consumer#setRoutes()
The following examples show how to use
com.alibaba.dubbo.registry.common.domain.Consumer#setRoutes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Consumers.java From dubbox with Apache License 2.0 | 5 votes |
public void show(Long id, Map<String, Object> context) { Consumer consumer = consumerService.findConsumer(id); List<Provider> providers = providerService.findByService(consumer.getService()); List<Route> routes = routeService.findByService(consumer.getService()); List<Override> overrides = overrideService.findByService(consumer.getService()); List<Route> routed = new ArrayList<Route>(); consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed)); consumer.setRoutes(routed); OverrideUtils.setConsumerOverrides(consumer, overrides); context.put("consumer", consumer); context.put("providers", consumer.getProviders()); context.put("routes", consumer.getRoutes()); context.put("overrides", consumer.getOverrides()); }
Example 2
Source File: Consumers.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public void show(Long id, Map<String, Object> context) { Consumer consumer = consumerService.findConsumer(id); List<Provider> providers = providerService.findByService(consumer.getService()); List<Route> routes = routeService.findByService(consumer.getService()); List<Override> overrides = overrideService.findByService(consumer.getService()); List<Route> routed = new ArrayList<Route>(); consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed)); consumer.setRoutes(routed); OverrideUtils.setConsumerOverrides(consumer, overrides); context.put("consumer", consumer); context.put("providers", consumer.getProviders()); context.put("routes", consumer.getRoutes()); context.put("overrides", consumer.getOverrides()); }
Example 3
Source File: Consumers.java From dubbo3 with Apache License 2.0 | 5 votes |
public void show(Long id, Map<String, Object> context) { Consumer consumer = consumerService.findConsumer(id); List<Provider> providers = providerService.findByService(consumer.getService()); List<Route> routes = routeService.findByService(consumer.getService()); List<Override> overrides = overrideService.findByService(consumer.getService()); List<Route> routed = new ArrayList<Route>(); consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed)); consumer.setRoutes(routed); OverrideUtils.setConsumerOverrides(consumer, overrides); context.put("consumer", consumer); context.put("providers", consumer.getProviders()); context.put("routes", consumer.getRoutes()); context.put("overrides", consumer.getOverrides()); }
Example 4
Source File: Consumers.java From dubbox with Apache License 2.0 | 5 votes |
public void show(Long id, Map<String, Object> context) { Consumer consumer = consumerService.findConsumer(id); List<Provider> providers = providerService.findByService(consumer.getService()); List<Route> routes = routeService.findByService(consumer.getService()); List<Override> overrides = overrideService.findByService(consumer.getService()); List<Route> routed = new ArrayList<Route>(); consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed)); consumer.setRoutes(routed); OverrideUtils.setConsumerOverrides(consumer, overrides); context.put("consumer", consumer); context.put("providers", consumer.getProviders()); context.put("routes", consumer.getRoutes()); context.put("overrides", consumer.getOverrides()); }
Example 5
Source File: Consumers.java From dubbox with Apache License 2.0 | 5 votes |
public void show(Long id, Map<String, Object> context) { Consumer consumer = consumerService.findConsumer(id); List<Provider> providers = providerService.findByService(consumer.getService()); List<Route> routes = routeService.findByService(consumer.getService()); List<Override> overrides = overrideService.findByService(consumer.getService()); List<Route> routed = new ArrayList<Route>(); consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed)); consumer.setRoutes(routed); OverrideUtils.setConsumerOverrides(consumer, overrides); context.put("consumer", consumer); context.put("providers", consumer.getProviders()); context.put("routes", consumer.getRoutes()); context.put("overrides", consumer.getOverrides()); }
Example 6
Source File: Consumers.java From dubbox with Apache License 2.0 | 4 votes |
public void index(Map<String, Object> context) throws Exception { String service = (String) context.get("service"); String application = (String) context.get("application"); String address = (String) context.get("address"); List<Consumer> consumers; List<Override> overrides; List<Provider> providers = null; List<Route> routes = null; // service if (service != null && service.length() > 0) { consumers = consumerService.findByService(service); overrides = overrideService.findByService(service); providers = providerService.findByService(service); routes = routeService.findByService(service); } // address else if (address != null && address.length() > 0) { consumers = consumerService.findByAddress(address); overrides = overrideService.findByAddress(Tool.getIP(address)); } // application else if (application != null && application.length() > 0) { consumers = consumerService.findByApplication(application); overrides = overrideService.findByApplication(application); } // all else { consumers = consumerService.findAll(); overrides = overrideService.findAll(); } if (consumers != null && consumers.size() > 0) { for (Consumer consumer : consumers) { if (service == null || service.length() == 0) { providers = providerService.findByService(consumer.getService()); routes = routeService.findByService(consumer.getService()); } List<Route> routed = new ArrayList<Route>(); consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed)); consumer.setRoutes(routed); OverrideUtils.setConsumerOverrides(consumer, overrides); } } context.put("consumers", consumers); }
Example 7
Source File: Consumers.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public void index(Map<String, Object> context) throws Exception { String service = (String) context.get("service"); String application = (String) context.get("application"); String address = (String) context.get("address"); List<Consumer> consumers; List<Override> overrides; List<Provider> providers = null; List<Route> routes = null; // service if (service != null && service.length() > 0) { consumers = consumerService.findByService(service); overrides = overrideService.findByService(service); providers = providerService.findByService(service); routes = routeService.findByService(service); } // address else if (address != null && address.length() > 0) { consumers = consumerService.findByAddress(address); overrides = overrideService.findByAddress(Tool.getIP(address)); } // application else if (application != null && application.length() > 0) { consumers = consumerService.findByApplication(application); overrides = overrideService.findByApplication(application); } // all else { consumers = consumerService.findAll(); overrides = overrideService.findAll(); } if (consumers != null && consumers.size() > 0) { for (Consumer consumer : consumers) { if (service == null || service.length() == 0) { providers = providerService.findByService(consumer.getService()); routes = routeService.findByService(consumer.getService()); } List<Route> routed = new ArrayList<Route>(); consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed)); consumer.setRoutes(routed); OverrideUtils.setConsumerOverrides(consumer, overrides); } } context.put("consumers", consumers); }
Example 8
Source File: Consumers.java From dubbo3 with Apache License 2.0 | 4 votes |
public void index(Map<String, Object> context) throws Exception { String service = (String) context.get("service"); String application = (String) context.get("application"); String address = (String) context.get("address"); List<Consumer> consumers; List<Override> overrides; List<Provider> providers = null; List<Route> routes = null; // service if (service != null && service.length() > 0) { consumers = consumerService.findByService(service); overrides = overrideService.findByService(service); providers = providerService.findByService(service); routes = routeService.findByService(service); } // address else if (address != null && address.length() > 0) { consumers = consumerService.findByAddress(address); overrides = overrideService.findByAddress(Tool.getIP(address)); } // application else if (application != null && application.length() > 0) { consumers = consumerService.findByApplication(application); overrides = overrideService.findByApplication(application); } // all else { consumers = consumerService.findAll(); overrides = overrideService.findAll(); } if (consumers != null && consumers.size() > 0) { for (Consumer consumer : consumers) { if (service == null || service.length() == 0) { providers = providerService.findByService(consumer.getService()); routes = routeService.findByService(consumer.getService()); } List<Route> routed = new ArrayList<Route>(); consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed)); consumer.setRoutes(routed); OverrideUtils.setConsumerOverrides(consumer, overrides); } } context.put("consumers", consumers); }
Example 9
Source File: Consumers.java From dubbox with Apache License 2.0 | 4 votes |
public void index(Map<String, Object> context) throws Exception { String service = (String) context.get("service"); String application = (String) context.get("application"); String address = (String) context.get("address"); List<Consumer> consumers; List<Override> overrides; List<Provider> providers = null; List<Route> routes = null; // service if (service != null && service.length() > 0) { consumers = consumerService.findByService(service); overrides = overrideService.findByService(service); providers = providerService.findByService(service); routes = routeService.findByService(service); } // address else if (address != null && address.length() > 0) { consumers = consumerService.findByAddress(address); overrides = overrideService.findByAddress(Tool.getIP(address)); } // application else if (application != null && application.length() > 0) { consumers = consumerService.findByApplication(application); overrides = overrideService.findByApplication(application); } // all else { consumers = consumerService.findAll(); overrides = overrideService.findAll(); } if (consumers != null && consumers.size() > 0) { for (Consumer consumer : consumers) { if (service == null || service.length() == 0) { providers = providerService.findByService(consumer.getService()); routes = routeService.findByService(consumer.getService()); } List<Route> routed = new ArrayList<Route>(); consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed)); consumer.setRoutes(routed); OverrideUtils.setConsumerOverrides(consumer, overrides); } } context.put("consumers", consumers); }
Example 10
Source File: Consumers.java From dubbox with Apache License 2.0 | 4 votes |
public void index(Map<String, Object> context) throws Exception { String service = (String) context.get("service"); String application = (String) context.get("application"); String address = (String) context.get("address"); List<Consumer> consumers; List<Override> overrides; List<Provider> providers = null; List<Route> routes = null; // service if (service != null && service.length() > 0) { consumers = consumerService.findByService(service); overrides = overrideService.findByService(service); providers = providerService.findByService(service); routes = routeService.findByService(service); } // address else if (address != null && address.length() > 0) { consumers = consumerService.findByAddress(address); overrides = overrideService.findByAddress(Tool.getIP(address)); } // application else if (application != null && application.length() > 0) { consumers = consumerService.findByApplication(application); overrides = overrideService.findByApplication(application); } // all else { consumers = consumerService.findAll(); overrides = overrideService.findAll(); } if (consumers != null && consumers.size() > 0) { for (Consumer consumer : consumers) { if (service == null || service.length() == 0) { providers = providerService.findByService(consumer.getService()); routes = routeService.findByService(consumer.getService()); } List<Route> routed = new ArrayList<Route>(); consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed)); consumer.setRoutes(routed); OverrideUtils.setConsumerOverrides(consumer, overrides); } } context.put("consumers", consumers); }