use of org.apache.dubbo.config.RegistryConfig in project pinpoint by naver.
the class DubboProviderApplication method startWithBootstrap.
private static void startWithBootstrap() {
ServiceConfig<GreetingsServiceImpl> service = new ServiceConfig<>();
service.setInterface(GreetingsService.class);
service.setRef(new GreetingsServiceImpl());
DubboBootstrap bootstrap = DubboBootstrap.getInstance();
bootstrap.application(new ApplicationConfig("dubbo-demo-api-provider")).registry(new RegistryConfig("zookeeper://" + ZOOKEEPER_HOST + ":2181")).service(service).start().await();
}
use of org.apache.dubbo.config.RegistryConfig in project dubbo by alibaba.
the class DubboServiceProviderBootstrap method multipleRegistries.
private static void multipleRegistries() {
ProtocolConfig restProtocol = new ProtocolConfig();
restProtocol.setName("rest");
restProtocol.setId("rest");
restProtocol.setPort(-1);
RegistryConfig interfaceRegistry = new RegistryConfig();
interfaceRegistry.setId("interfaceRegistry");
interfaceRegistry.setAddress("zookeeper://127.0.0.1:2181");
RegistryConfig serviceRegistry = new RegistryConfig();
serviceRegistry.setId("serviceRegistry");
serviceRegistry.setAddress("zookeeper://127.0.0.1:2181?registry-type=service");
ServiceConfig<EchoService> echoService = new ServiceConfig<>();
echoService.setInterface(EchoService.class.getName());
echoService.setRef(new EchoServiceImpl());
// echoService.setRegistries(Arrays.asList(interfaceRegistry, serviceRegistry));
ServiceConfig<UserService> userService = new ServiceConfig<>();
userService.setInterface(UserService.class.getName());
userService.setRef(new UserServiceImpl());
userService.setProtocol(restProtocol);
// userService.setRegistries(Arrays.asList(interfaceRegistry, serviceRegistry));
ApplicationConfig applicationConfig = new ApplicationConfig("dubbo-provider-demo");
applicationConfig.setMetadataType("remote");
DubboBootstrap.getInstance().application(applicationConfig).registries(Arrays.asList(interfaceRegistry, serviceRegistry)).protocol(builder -> builder.port(-1).name("dubbo")).metadataReport(new MetadataReportConfig("zookeeper://127.0.0.1:2181")).service(echoService).service(userService).start().await();
}
use of org.apache.dubbo.config.RegistryConfig in project dubbo by alibaba.
the class EtcdDubboServiceProviderBootstrap method multipleRegistries.
private static void multipleRegistries() {
ProtocolConfig restProtocol = new ProtocolConfig();
restProtocol.setName("rest");
restProtocol.setId("rest");
restProtocol.setPort(-1);
RegistryConfig interfaceRegistry = new RegistryConfig();
interfaceRegistry.setId("interfaceRegistry");
interfaceRegistry.setAddress("etcd3://127.0.0.1:2379");
RegistryConfig serviceRegistry = new RegistryConfig();
serviceRegistry.setId("serviceRegistry");
serviceRegistry.setAddress("etcd3://127.0.0.1:2379?registry-type=service");
ServiceConfig<EchoService> echoService = new ServiceConfig<>();
echoService.setInterface(EchoService.class.getName());
echoService.setRef(new EchoServiceImpl());
// echoService.setRegistries(Arrays.asList(interfaceRegistry, serviceRegistry));
ServiceConfig<UserService> userService = new ServiceConfig<>();
userService.setInterface(UserService.class.getName());
userService.setRef(new UserServiceImpl());
userService.setProtocol(restProtocol);
// userService.setRegistries(Arrays.asList(interfaceRegistry, serviceRegistry));
ApplicationConfig applicationConfig = new ApplicationConfig("dubbo-provider-demo");
// applicationConfig.setMetadataType("remote");
DubboBootstrap.getInstance().application(applicationConfig).registries(Arrays.asList(interfaceRegistry, serviceRegistry)).protocol(builder -> builder.port(-1).name("dubbo")).service(echoService).service(userService).start().await();
}
use of org.apache.dubbo.config.RegistryConfig in project dubbo by alibaba.
the class AbstractInterfaceBuilderTest method addRegistry.
@Test
void addRegistry() {
RegistryConfig registryConfig = new RegistryConfig();
InterfaceBuilder builder = new InterfaceBuilder();
builder.addRegistry(registryConfig);
Assertions.assertEquals(1, builder.build().getRegistries().size());
Assertions.assertSame(registryConfig, builder.build().getRegistries().get(0));
Assertions.assertSame(registryConfig, builder.build().getRegistry());
}
use of org.apache.dubbo.config.RegistryConfig in project dubbo by alibaba.
the class AbstractInterfaceBuilderTest method addRegistries.
@Test
void addRegistries() {
RegistryConfig registryConfig = new RegistryConfig();
InterfaceBuilder builder = new InterfaceBuilder();
builder.addRegistries(Collections.singletonList(registryConfig));
Assertions.assertEquals(1, builder.build().getRegistries().size());
Assertions.assertSame(registryConfig, builder.build().getRegistries().get(0));
Assertions.assertSame(registryConfig, builder.build().getRegistry());
}
Aggregations