Search in sources :

Example 1 with RegistryFactory

use of org.apache.dubbo.registry.RegistryFactory in project incubator-dubbo-ops by apache.

the class ConfigCenter method getRegistry.

/*
     * generate registry client
     */
@Bean("dubboRegistry")
@DependsOn("governanceConfiguration")
Registry getRegistry() {
    Registry registry = null;
    if (registryUrl == null) {
        if (StringUtils.isBlank(registryAddress)) {
            throw new ConfigurationException("Either config center or registry address is needed, please refer to https://github.com/apache/incubator-dubbo-admin/wiki/Dubbo-Admin-configuration");
        }
        registryUrl = formUrl(registryAddress, registryGroup, registryNameSpace, username, password);
    }
    RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension();
    registry = registryFactory.getRegistry(registryUrl);
    return registry;
}
Also used : RegistryFactory(org.apache.dubbo.registry.RegistryFactory) ConfigurationException(org.apache.dubbo.admin.common.exception.ConfigurationException) Registry(org.apache.dubbo.registry.Registry) DependsOn(org.springframework.context.annotation.DependsOn) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConfigurationException (org.apache.dubbo.admin.common.exception.ConfigurationException)1 Registry (org.apache.dubbo.registry.Registry)1 RegistryFactory (org.apache.dubbo.registry.RegistryFactory)1 Bean (org.springframework.context.annotation.Bean)1 DependsOn (org.springframework.context.annotation.DependsOn)1