Search in sources :

Example 1 with NacosNamingServiceWrapper

use of org.apache.dubbo.registry.nacos.NacosNamingServiceWrapper in project dubbo by alibaba.

the class NacosNamingServiceUtils method createNamingService.

/**
 * Create an instance of {@link NamingService} from specified {@link URL connection url}
 *
 * @param connectionURL {@link URL connection url}
 * @return {@link NamingService}
 * @since 2.7.5
 */
public static NacosNamingServiceWrapper createNamingService(URL connectionURL) {
    Properties nacosProperties = buildNacosProperties(connectionURL);
    NamingService namingService;
    try {
        namingService = NacosFactory.createNamingService(nacosProperties);
    } catch (NacosException e) {
        if (logger.isErrorEnabled()) {
            logger.error(e.getErrMsg(), e);
        }
        throw new IllegalStateException(e);
    }
    return new NacosNamingServiceWrapper(namingService);
}
Also used : NacosNamingServiceWrapper(org.apache.dubbo.registry.nacos.NacosNamingServiceWrapper) NamingService(com.alibaba.nacos.api.naming.NamingService) Properties(java.util.Properties) NacosException(com.alibaba.nacos.api.exception.NacosException)

Aggregations

NacosException (com.alibaba.nacos.api.exception.NacosException)1 NamingService (com.alibaba.nacos.api.naming.NamingService)1 Properties (java.util.Properties)1 NacosNamingServiceWrapper (org.apache.dubbo.registry.nacos.NacosNamingServiceWrapper)1