use of com.ecwid.consul.v1.ConsulClient in project motan by weibocom.
the class ConsulClientWrapper method init.
@PostConstruct
void init() {
try {
String[] arr = registryUrl.split(":");
String host = arr[0];
int port = Integer.parseInt(arr[1]);
consulClient = new ConsulClient(host, port);
} catch (Exception e) {
throw new MotanFrameworkException("Fail to connect consul, cause: " + e.getMessage());
}
}
use of com.ecwid.consul.v1.ConsulClient in project dubbo by alibaba.
the class ConsulServiceDiscovery method initialize.
@Override
public void initialize(URL registryURL) throws Exception {
this.url = registryURL;
String host = url.getHost();
int port = INVALID_PORT != url.getPort() ? url.getPort() : DEFAULT_PORT;
checkPassInterval = url.getParameter(CHECK_PASS_INTERVAL, DEFAULT_CHECK_PASS_INTERVAL);
client = new ConsulClient(host, port);
ttlScheduler = new TtlScheduler(checkPassInterval, client);
this.tag = registryURL.getParameter(QUERY_TAG);
this.registeringTags.addAll(getRegisteringTags(url));
this.aclToken = ACL_TOKEN.getValue(registryURL);
this.tags = getTags(registryURL);
this.consistencyMode = getConsistencyMode(registryURL);
this.defaultZoneMetadataName = DEFAULT_ZONE_METADATA_NAME.getValue(registryURL);
this.instanceZone = INSTANCE_ZONE.getValue(registryURL);
this.instanceGroup = INSTANCE_GROUP.getValue(registryURL);
}
Aggregations