use of org.apache.dubbo.config.RegistryConfig in project incubator-dubbo-spring-boot-project by apache.
the class RelaxedDubboConfigBinderTest method testBinder.
@Test
public void testBinder() {
ApplicationConfig applicationConfig = new ApplicationConfig();
Map<String, Object> properties = getSubProperties(environment.getPropertySources(), "dubbo.application");
dubboConfigBinder.bind(properties, true, true, applicationConfig);
Assert.assertEquals("hello", applicationConfig.getName());
Assert.assertEquals("world", applicationConfig.getOwner());
RegistryConfig registryConfig = new RegistryConfig();
properties = getSubProperties(environment.getPropertySources(), "dubbo.registry");
dubboConfigBinder.bind(properties, true, true, registryConfig);
Assert.assertEquals("10.20.153.17", registryConfig.getAddress());
ProtocolConfig protocolConfig = new ProtocolConfig();
properties = getSubProperties(environment.getPropertySources(), "dubbo.protocol");
dubboConfigBinder.bind(properties, true, true, protocolConfig);
Assert.assertEquals(Integer.valueOf(20881), protocolConfig.getPort());
}
use of org.apache.dubbo.config.RegistryConfig in project incubator-dubbo-ops by apache.
the class ApiDocsDubboGenericUtil method getRegistryConfig.
/**
* Get registry information.
*
* @param address Address of Registration Center
* @return org.apache.dubbo.config.RegistryConfig
*/
private static RegistryConfig getRegistryConfig(String address) {
RegistryConfig registryConfig = registryConfigCache.get(address);
if (null == registryConfig) {
registryConfig = new RegistryConfig();
registryConfig.setAddress(address);
registryConfig.setRegister(false);
registryConfigCache.put(address, registryConfig);
}
return registryConfig;
}
use of org.apache.dubbo.config.RegistryConfig in project incubator-dubbo-ops by apache.
the class GenericServiceImpl method init.
@PostConstruct
public void init() {
RegistryConfig registryConfig = buildRegistryConfig(registry);
applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo-admin");
applicationConfig.setRegistry(registryConfig);
}
use of org.apache.dubbo.config.RegistryConfig in project incubator-dubbo-ops by apache.
the class GenericServiceImpl method buildRegistryConfig.
private RegistryConfig buildRegistryConfig(Registry registry) {
URL fromUrl = registry.getUrl();
RegistryConfig config = new RegistryConfig();
config.setGroup(fromUrl.getParameter("group"));
URL address = URL.valueOf(fromUrl.getProtocol() + "://" + fromUrl.getAddress());
if (fromUrl.hasParameter(Constants.NAMESPACE_KEY)) {
address = address.addParameter(Constants.NAMESPACE_KEY, fromUrl.getParameter(Constants.NAMESPACE_KEY));
}
config.setAddress(address.toString());
return config;
}
use of org.apache.dubbo.config.RegistryConfig in project pinpoint by naver.
the class DubboConsumerPluginTestController method sayHi.
@RequestMapping(value = "/sayHi", method = RequestMethod.GET)
@ResponseBody
public String sayHi() {
ReferenceConfig<GreetingsService> reference = new ReferenceConfig<>();
reference.setInterface(GreetingsService.class);
reference.setGeneric("true");
DubboBootstrap bootstrap = DubboBootstrap.getInstance();
bootstrap.application(new ApplicationConfig("dubbo-demo-api-consumer")).registry(new RegistryConfig("zookeeper://" + ZOOKEEPER_HOST + ":2181")).reference(reference).start();
GreetingsService demoService = ReferenceConfigCache.getCache().get(reference);
String message = demoService.sayHi("dubbo");
return message;
}
Aggregations