Search in sources :

Example 1 with ServiceInstanceBuilder

use of org.apache.curator.x.discovery.ServiceInstanceBuilder in project dubbo by alibaba.

the class CuratorFrameworkUtils method build.

public static org.apache.curator.x.discovery.ServiceInstance<ZookeeperInstance> build(ServiceInstance serviceInstance) {
    ServiceInstanceBuilder builder = null;
    String serviceName = serviceInstance.getServiceName();
    String host = serviceInstance.getHost();
    int port = serviceInstance.getPort();
    Map<String, String> metadata = serviceInstance.getMetadata();
    String id = generateId(host, port);
    ZookeeperInstance zookeeperInstance = new ZookeeperInstance(null, serviceName, metadata);
    try {
        builder = builder().id(id).name(serviceName).address(host).port(port).payload(zookeeperInstance);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return builder.build();
}
Also used : ZookeeperInstance(org.apache.dubbo.registry.zookeeper.ZookeeperInstance) ServiceInstanceBuilder(org.apache.curator.x.discovery.ServiceInstanceBuilder)

Aggregations

ServiceInstanceBuilder (org.apache.curator.x.discovery.ServiceInstanceBuilder)1 ZookeeperInstance (org.apache.dubbo.registry.zookeeper.ZookeeperInstance)1