当前位置: 首页>>代码示例>>Java>>正文


Java Consumer.setRoutes方法代码示例

本文整理汇总了Java中com.alibaba.dubbo.registry.common.domain.Consumer.setRoutes方法的典型用法代码示例。如果您正苦于以下问题:Java Consumer.setRoutes方法的具体用法?Java Consumer.setRoutes怎么用?Java Consumer.setRoutes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.dubbo.registry.common.domain.Consumer的用法示例。


在下文中一共展示了Consumer.setRoutes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: show

import com.alibaba.dubbo.registry.common.domain.Consumer; //导入方法依赖的package包/类
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());
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:15,代码来源:Consumers.java

示例2: show

import com.alibaba.dubbo.registry.common.domain.Consumer; //导入方法依赖的package包/类
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());
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:15,代码来源:Consumers.java

示例3: index

import com.alibaba.dubbo.registry.common.domain.Consumer; //导入方法依赖的package包/类
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);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:45,代码来源:Consumers.java

示例4: index

import com.alibaba.dubbo.registry.common.domain.Consumer; //导入方法依赖的package包/类
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);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:45,代码来源:Consumers.java


注:本文中的com.alibaba.dubbo.registry.common.domain.Consumer.setRoutes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。