com.alibaba.dubbo.config.ConsumerConfig Java Examples
The following examples show how to use
com.alibaba.dubbo.config.ConsumerConfig.
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: DefaultDubboConfigBinderTest.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Test public void testBinder() { ApplicationConfig applicationConfig = new ApplicationConfig(); dubboConfigBinder.bind("dubbo.application", applicationConfig); Assert.assertEquals("hello", applicationConfig.getName()); Assert.assertEquals("world", applicationConfig.getOwner()); RegistryConfig registryConfig = new RegistryConfig(); dubboConfigBinder.bind("dubbo.registry", registryConfig); Assert.assertEquals("10.20.153.17", registryConfig.getAddress()); ProtocolConfig protocolConfig = new ProtocolConfig(); dubboConfigBinder.bind("dubbo.protocol", protocolConfig); Assert.assertEquals(Integer.valueOf(20881), protocolConfig.getPort()); ConsumerConfig consumerConfig = new ConsumerConfig(); dubboConfigBinder.bind("dubbo.consumer", consumerConfig); Assert.assertEquals(isDefault, consumerConfig.isDefault()); Assert.assertEquals(client, consumerConfig.getClient()); Assert.assertEquals(threadPool, consumerConfig.getThreadpool()); Assert.assertEquals(coreThreads, consumerConfig.getCorethreads()); Assert.assertEquals(threads, consumerConfig.getThreads()); Assert.assertEquals(queues, consumerConfig.getQueues()); }
Example #2
Source File: DubboAutoConfiguration.java From spring-boot-starter-dubbo with Apache License 2.0 | 6 votes |
private void registerConsumer(ConsumerConfig consumer, ConfigurableListableBeanFactory beanFactory) { if (consumer != null) { String beanName = consumer.getId(); if (StringUtils.isEmpty(beanName)) { beanName = "consumerConfig"; } String filter = consumer.getFilter(); if (StringUtils.isEmpty(filter)) { filter = "regerConsumerFilter"; } else { filter = filter.trim() + ",regerConsumerFilter"; } logger.debug("添加consumerFilter后的Filter, {}", filter); consumer.setFilter(filter); beanFactory.registerSingleton(beanName, consumer); } else { logger.debug("dubbo 没有配置默认的消费者参数"); } }
Example #3
Source File: DubboNamespaceHandler.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Override public void init() { // xml配置解析=》 registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true)); registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true)); registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true)); registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true)); registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true)); registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true)); registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true)); registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true)); registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false)); // annotation解析<dubbo:annotation package="" />xml配置=》 registerBeanDefinitionParser("annotation", new AnnotationBeanDefinitionParser()); }
Example #4
Source File: InvokerSideConfigUrlTest.java From dubbox with Apache License 2.0 | 5 votes |
private void initRefConf(){ appConfForConsumer = new ApplicationConfig(); appConfForReference = new ApplicationConfig(); regConfForConsumer = new RegistryConfig(); regConfForReference = new RegistryConfig(); methodConfForReference = new MethodConfig(); refConf = new ReferenceConfig<DemoService>(); consumerConf = new ConsumerConfig(); methodConfForReference.setName("sayName"); regConfForReference.setAddress("127.0.0.1:9090"); regConfForReference.setProtocol("mockregistry"); appConfForReference.setName("ConfigTests"); refConf.setInterface("com.alibaba.dubbo.config.api.DemoService"); refConf.setApplication(appConfForReference); consumerConf.setApplication(appConfForConsumer); refConf.setRegistry(regConfForReference); consumerConf.setRegistry(regConfForConsumer); refConf.setConsumer(consumerConf); refConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForReference})); refConf.setScope(Constants.SCOPE_REMOTE); }
Example #5
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 5 votes |
@Test public void testRmiTimeout() throws Exception { if (System.getProperty("sun.rmi.transport.tcp.responseTimeout") != null) { System.setProperty("sun.rmi.transport.tcp.responseTimeout", ""); } ConsumerConfig consumer = new ConsumerConfig(); consumer.setTimeout(1000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); consumer.setTimeout(2000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); }
Example #6
Source File: DubboNamespaceHandler.java From dubbox with Apache License 2.0 | 5 votes |
public void init() { registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true)); registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true)); registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true)); registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true)); registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true)); registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true)); registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true)); registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true)); registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false)); registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true)); }
Example #7
Source File: InvokerSideConfigUrlTest.java From dubbox with Apache License 2.0 | 5 votes |
private void initRefConf(){ appConfForConsumer = new ApplicationConfig(); appConfForReference = new ApplicationConfig(); regConfForConsumer = new RegistryConfig(); regConfForReference = new RegistryConfig(); methodConfForReference = new MethodConfig(); refConf = new ReferenceConfig<DemoService>(); consumerConf = new ConsumerConfig(); methodConfForReference.setName("sayName"); regConfForReference.setAddress("127.0.0.1:9090"); regConfForReference.setProtocol("mockregistry"); appConfForReference.setName("ConfigTests"); refConf.setInterface("com.alibaba.dubbo.config.api.DemoService"); refConf.setApplication(appConfForReference); consumerConf.setApplication(appConfForConsumer); refConf.setRegistry(regConfForReference); consumerConf.setRegistry(regConfForConsumer); refConf.setConsumer(consumerConf); refConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForReference})); refConf.setScope(Constants.SCOPE_REMOTE); }
Example #8
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 5 votes |
@Test public void testRmiTimeout() throws Exception { if (System.getProperty("sun.rmi.transport.tcp.responseTimeout") != null) { System.setProperty("sun.rmi.transport.tcp.responseTimeout", ""); } ConsumerConfig consumer = new ConsumerConfig(); consumer.setTimeout(1000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); consumer.setTimeout(2000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); }
Example #9
Source File: DubboNamespaceHandler.java From dubbox with Apache License 2.0 | 5 votes |
public void init() { registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true)); registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true)); registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true)); registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true)); registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true)); registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true)); registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true)); registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true)); registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false)); registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true)); }
Example #10
Source File: InvokerSideConfigUrlTest.java From dubbo3 with Apache License 2.0 | 5 votes |
private void initRefConf(){ appConfForConsumer = new ApplicationConfig(); appConfForReference = new ApplicationConfig(); regConfForConsumer = new RegistryConfig(); regConfForReference = new RegistryConfig(); methodConfForReference = new MethodConfig(); refConf = new ReferenceConfig<DemoService>(); consumerConf = new ConsumerConfig(); methodConfForReference.setName("sayName"); regConfForReference.setAddress("127.0.0.1:9090"); regConfForReference.setProtocol("mockregistry"); appConfForReference.setName("ConfigTests"); refConf.setInterface("com.alibaba.dubbo.config.api.DemoService"); refConf.setApplication(appConfForReference); consumerConf.setApplication(appConfForConsumer); refConf.setRegistry(regConfForReference); consumerConf.setRegistry(regConfForConsumer); refConf.setConsumer(consumerConf); refConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForReference})); refConf.setScope(Constants.SCOPE_REMOTE); }
Example #11
Source File: ConfigTest.java From dubbo3 with Apache License 2.0 | 5 votes |
@Test public void testRmiTimeout() throws Exception { if (System.getProperty("sun.rmi.transport.tcp.responseTimeout") != null) { System.setProperty("sun.rmi.transport.tcp.responseTimeout", ""); } ConsumerConfig consumer = new ConsumerConfig(); consumer.setTimeout(1000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); consumer.setTimeout(2000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); }
Example #12
Source File: DubboNamespaceHandler.java From dubbo3 with Apache License 2.0 | 5 votes |
public void init() { registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true)); registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true)); registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true)); registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true)); registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true)); registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true)); registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true)); registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true)); registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false)); registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true)); }
Example #13
Source File: DubboAutoConfiguration.java From spring-boot-starter-dubbo with Apache License 2.0 | 5 votes |
@Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { DubboProperties dubboProperties = this.getPropertiesConfigurationBean(DubboProperties.targetName, DubboProperties.class); ApplicationConfig application = dubboProperties.getApplication(); MonitorConfig monitor = dubboProperties.getMonitor(); ModuleConfig module = dubboProperties.getModule(); ProviderConfig provider = dubboProperties.getProvider(); ConsumerConfig consumer = dubboProperties.getConsumer(); List<ProtocolConfig> protocols = this.getProtocols(dubboProperties); List<RegistryConfig> registryConfigs = this.getRegistrys(dubboProperties); List<ReferenceConfig<?>> references = dubboProperties.getReferences(); List<ServiceConfig<?>> services = dubboProperties.getServices(); this.registerRegistry(registryConfigs, beanFactory); String basePackage = dubboProperties.getBasePackage(); if (provider != null) { provider.setProtocols(this.getProtocol(protocols, "spring.dubbo.provider.protocol")); provider.setRegistries(this.getRegistry(registryConfigs, "spring.dubbo.provider.registry")); } if (consumer != null) { consumer.setRegistries(this.getRegistry(registryConfigs, "spring.dubbo.consumer.registry")); } this.registerThis(basePackage, beanFactory); this.registerApplication(application, beanFactory); this.registerProtocols(protocols, beanFactory); this.registerMonitor(monitor, beanFactory); this.registerModule(module, beanFactory); this.registerProvider(provider, beanFactory); this.registerConsumer(consumer, beanFactory); this.registerReferences(references, beanFactory); this.registerServices(services, beanFactory); super.postProcessBeanFactory(beanFactory); super.postProcessAnnotationPackageService(); }
Example #14
Source File: InvokerSideConfigUrlTest.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
private void initRefConf(){ appConfForConsumer = new ApplicationConfig(); appConfForReference = new ApplicationConfig(); regConfForConsumer = new RegistryConfig(); regConfForReference = new RegistryConfig(); methodConfForReference = new MethodConfig(); refConf = new ReferenceConfig<DemoService>(); consumerConf = new ConsumerConfig(); methodConfForReference.setName("sayName"); regConfForReference.setAddress("127.0.0.1:9090"); regConfForReference.setProtocol("mockregistry"); appConfForReference.setName("ConfigTests"); refConf.setInterface("com.alibaba.dubbo.config.api.DemoService"); refConf.setApplication(appConfForReference); consumerConf.setApplication(appConfForConsumer); refConf.setRegistry(regConfForReference); consumerConf.setRegistry(regConfForConsumer); refConf.setConsumer(consumerConf); refConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForReference})); refConf.setScope(Constants.SCOPE_REMOTE); }
Example #15
Source File: ConfigTest.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
@Test public void testRmiTimeout() throws Exception { if (System.getProperty("sun.rmi.transport.tcp.responseTimeout") != null) { System.setProperty("sun.rmi.transport.tcp.responseTimeout", ""); } ConsumerConfig consumer = new ConsumerConfig(); consumer.setTimeout(1000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); consumer.setTimeout(2000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); }
Example #16
Source File: InvokerSideConfigUrlTest.java From dubbox with Apache License 2.0 | 5 votes |
private void initRefConf(){ appConfForConsumer = new ApplicationConfig(); appConfForReference = new ApplicationConfig(); regConfForConsumer = new RegistryConfig(); regConfForReference = new RegistryConfig(); methodConfForReference = new MethodConfig(); refConf = new ReferenceConfig<DemoService>(); consumerConf = new ConsumerConfig(); methodConfForReference.setName("sayName"); regConfForReference.setAddress("127.0.0.1:9090"); regConfForReference.setProtocol("mockregistry"); appConfForReference.setName("ConfigTests"); refConf.setInterface("com.alibaba.dubbo.config.api.DemoService"); refConf.setApplication(appConfForReference); consumerConf.setApplication(appConfForConsumer); refConf.setRegistry(regConfForReference); consumerConf.setRegistry(regConfForConsumer); refConf.setConsumer(consumerConf); refConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForReference})); refConf.setScope(Constants.SCOPE_REMOTE); }
Example #17
Source File: EnableDubboConfigTest.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Test public void testSingle() { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(TestConfig.class); context.refresh(); // application ApplicationConfig applicationConfig = context.getBean("applicationBean", ApplicationConfig.class); Assert.assertEquals("dubbo-demo-application", applicationConfig.getName()); // module ModuleConfig moduleConfig = context.getBean("moduleBean", ModuleConfig.class); Assert.assertEquals("dubbo-demo-module", moduleConfig.getName()); // registry RegistryConfig registryConfig = context.getBean(RegistryConfig.class); Assert.assertEquals("zookeeper://192.168.99.100:32770", registryConfig.getAddress()); // protocol ProtocolConfig protocolConfig = context.getBean(ProtocolConfig.class); Assert.assertEquals("dubbo", protocolConfig.getName()); Assert.assertEquals(Integer.valueOf(20880), protocolConfig.getPort()); // monitor MonitorConfig monitorConfig = context.getBean(MonitorConfig.class); Assert.assertEquals("zookeeper://127.0.0.1:32770", monitorConfig.getAddress()); // provider ProviderConfig providerConfig = context.getBean(ProviderConfig.class); Assert.assertEquals("127.0.0.1", providerConfig.getHost()); // consumer ConsumerConfig consumerConfig = context.getBean(ConsumerConfig.class); Assert.assertEquals("netty", consumerConfig.getClient()); }
Example #18
Source File: ConfigTest.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Test public void testRmiTimeout() throws Exception { if (System.getProperty("sun.rmi.transport.tcp.responseTimeout") != null) { System.setProperty("sun.rmi.transport.tcp.responseTimeout", ""); } ConsumerConfig consumer = new ConsumerConfig(); consumer.setTimeout(1000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); consumer.setTimeout(2000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); }
Example #19
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 5 votes |
@Test public void testRmiTimeout() throws Exception { if (System.getProperty("sun.rmi.transport.tcp.responseTimeout") != null) { System.setProperty("sun.rmi.transport.tcp.responseTimeout", ""); } ConsumerConfig consumer = new ConsumerConfig(); consumer.setTimeout(1000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); consumer.setTimeout(2000); assertEquals("1000", System.getProperty("sun.rmi.transport.tcp.responseTimeout")); }
Example #20
Source File: DubboNamespaceHandler.java From dubbox with Apache License 2.0 | 5 votes |
public void init() { registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true)); registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true)); registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true)); registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true)); registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true)); registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true)); registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true)); registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true)); registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false)); registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true)); }
Example #21
Source File: InvokerSideConfigUrlTest.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
private void initRefConf() { appConfForConsumer = new ApplicationConfig(); appConfForReference = new ApplicationConfig(); regConfForConsumer = new RegistryConfig(); regConfForReference = new RegistryConfig(); methodConfForReference = new MethodConfig(); refConf = new ReferenceConfig<DemoService>(); consumerConf = new ConsumerConfig(); methodConfForReference.setName("sayName"); regConfForReference.setAddress("127.0.0.1:9090"); regConfForReference.setProtocol("mockregistry"); appConfForReference.setName("ConfigTests"); refConf.setInterface("com.alibaba.dubbo.config.api.DemoService"); refConf.setApplication(appConfForReference); consumerConf.setApplication(appConfForConsumer); refConf.setRegistry(regConfForReference); consumerConf.setRegistry(regConfForConsumer); refConf.setConsumer(consumerConf); refConf.setMethods(Arrays.asList(new MethodConfig[]{methodConfForReference})); refConf.setScope(Constants.SCOPE_REMOTE); }
Example #22
Source File: DubboEasyTransRpcConsumerImpl.java From EasyTransaction with Apache License 2.0 | 5 votes |
public DubboEasyTransRpcConsumerImpl(Optional<ApplicationConfig> applicationConfig, Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ConsumerConfig> consumerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboReferanceCustomizationer> customizationer) { super(); this.applicationConfig = applicationConfig.orElse(null); this.registryConfig = registryConfig.orElse(null); this.protocolConfig = protocolConfig.orElse(null); this.customizationer = customizationer.orElse(null); this.consumerConfig = consumerConfig.orElse(null); this.moduleConfig = moduleConfig.orElse(null); this.monitorConfig = monitorConfig.orElse(null); }
Example #23
Source File: DubboNamespaceHandler.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public void init() { registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true)); registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true)); registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true)); registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true)); registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true)); registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true)); registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true)); registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true)); registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false)); registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true)); }
Example #24
Source File: DubboMonitorConsumerFactory.java From EasyTransaction with Apache License 2.0 | 5 votes |
public DubboMonitorConsumerFactory(Optional<ApplicationConfig> applicationConfig, Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ConsumerConfig> consumerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboReferanceCustomizationer> customizationer) { super(); this.applicationConfig = applicationConfig.orElse(null); this.registryConfig = registryConfig.orElse(null); this.protocolConfig = protocolConfig.orElse(null); this.customizationer = customizationer.orElse(null); this.consumerConfig = consumerConfig.orElse(null); this.moduleConfig = moduleConfig.orElse(null); this.monitorConfig = monitorConfig.orElse(null); }
Example #25
Source File: DubboProperties.java From spring-boot-starter-dubbo with Apache License 2.0 | 4 votes |
public void setConsumer(ConsumerConfig consumer) { this.consumer = consumer; }
Example #26
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 4 votes |
@Test public void testAppendFilter() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setFilter("classloader,monitor"); ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); service.setFilter("accesslog,trace"); service.setProvider(provider); service.setProtocol(new ProtocolConfig("dubbo", 20880)); service.setApplication(new ApplicationConfig("provider")); service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); try { service.export(); List<URL> urls = service.toUrls(); assertNotNull(urls); assertEquals(1, urls.size()); assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("service.filter")); ConsumerConfig consumer = new ConsumerConfig(); consumer.setFilter("classloader,monitor"); ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>(); reference.setFilter("accesslog,trace"); reference.setConsumer(consumer); reference.setApplication(new ApplicationConfig("consumer")); reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); reference.setInterface(DemoService.class); reference.setUrl("dubbo://" + NetUtils.getLocalHost() + ":20880?" + DemoService.class.getName() + "?check=false"); try { reference.get(); urls = reference.toUrls(); assertNotNull(urls); assertEquals(1, urls.size()); assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("reference.filter")); } finally { reference.destroy(); } } finally { service.unexport(); } }
Example #27
Source File: ConfigTest.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
@Test public void testAppendFilter() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setFilter("classloader,monitor"); ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); service.setFilter("accesslog,trace"); service.setProvider(provider); service.setProtocol(new ProtocolConfig("dubbo", 20880)); service.setApplication(new ApplicationConfig("provider")); service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); try { service.export(); List<URL> urls = service.toUrls(); assertNotNull(urls); assertEquals(1, urls.size()); assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("service.filter")); ConsumerConfig consumer = new ConsumerConfig(); consumer.setFilter("classloader,monitor"); ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>(); reference.setFilter("accesslog,trace"); reference.setConsumer(consumer); reference.setApplication(new ApplicationConfig("consumer")); reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); reference.setInterface(DemoService.class); reference.setUrl("dubbo://" + NetUtils.getLocalHost() + ":20880?" + DemoService.class.getName() + "?check=false"); try { reference.get(); urls = reference.toUrls(); assertNotNull(urls); assertEquals(1, urls.size()); assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("reference.filter")); } finally { reference.destroy(); } } finally { service.unexport(); } }
Example #28
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 4 votes |
@Test public void testAppendFilter() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setFilter("classloader,monitor"); ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); service.setFilter("accesslog,trace"); service.setProvider(provider); service.setProtocol(new ProtocolConfig("dubbo", 20880)); service.setApplication(new ApplicationConfig("provider")); service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); try { service.export(); List<URL> urls = service.toUrls(); assertNotNull(urls); assertEquals(1, urls.size()); assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("service.filter")); ConsumerConfig consumer = new ConsumerConfig(); consumer.setFilter("classloader,monitor"); ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>(); reference.setFilter("accesslog,trace"); reference.setConsumer(consumer); reference.setApplication(new ApplicationConfig("consumer")); reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); reference.setInterface(DemoService.class); reference.setUrl("dubbo://" + NetUtils.getLocalHost() + ":20880?" + DemoService.class.getName() + "?check=false"); try { reference.get(); urls = reference.toUrls(); assertNotNull(urls); assertEquals(1, urls.size()); assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("reference.filter")); } finally { reference.destroy(); } } finally { service.unexport(); } }
Example #29
Source File: DubboEasyTransRpcConfiguration.java From EasyTransaction with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean(EasyTransRpcConsumer.class) public DubboEasyTransRpcConsumerImpl dubboEasyTransRpcConsumerImpl(Optional<ApplicationConfig> applicationConfig, Optional<RegistryConfig> registryConfig,Optional<ProtocolConfig> protocolConfig,Optional<ConsumerConfig> consumerConfig,Optional<ModuleConfig> moduleConfig,Optional<MonitorConfig> monitorConfig, Optional<DubboReferanceCustomizationer> customizationer){ return new DubboEasyTransRpcConsumerImpl(applicationConfig, registryConfig, protocolConfig, consumerConfig, moduleConfig, monitorConfig, customizationer); }
Example #30
Source File: ConfigTest.java From dubbo3 with Apache License 2.0 | 4 votes |
@Test public void testAppendFilter() throws Exception { ProviderConfig provider = new ProviderConfig(); provider.setFilter("classloader,monitor"); ServiceConfig<DemoService> service = new ServiceConfig<DemoService>(); service.setFilter("accesslog,trace"); service.setProvider(provider); service.setProtocol(new ProtocolConfig("dubbo", 20880)); service.setApplication(new ApplicationConfig("provider")); service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); service.setInterface(DemoService.class); service.setRef(new DemoServiceImpl()); try { service.export(); List<URL> urls = service.toUrls(); assertNotNull(urls); assertEquals(1, urls.size()); assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("service.filter")); ConsumerConfig consumer = new ConsumerConfig(); consumer.setFilter("classloader,monitor"); ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>(); reference.setFilter("accesslog,trace"); reference.setConsumer(consumer); reference.setApplication(new ApplicationConfig("consumer")); reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); reference.setInterface(DemoService.class); reference.setUrl("dubbo://" + NetUtils.getLocalHost() + ":20880?" + DemoService.class.getName() + "?check=false"); try { reference.get(); urls = reference.toUrls(); assertNotNull(urls); assertEquals(1, urls.size()); assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("reference.filter")); } finally { reference.destroy(); } } finally { service.unexport(); } }