use of com.couchbase.client.core.service.ServiceType.KV in project couchbase-elasticsearch-connector by couchbase.
the class SeedNodeHelper method getKvNodes.
/**
* Returns complete host and port information for every node running the KV service.
*/
public static Set<SeedNode> getKvNodes(Bucket bucket, String connectionString, boolean tls, NetworkResolution networkResolution, Duration timeout) {
// Bucket config is most reliable way to determine KV ports
BucketConfig config = CouchbaseHelper.getConfig(bucket, timeout);
// so the actual node names can be used.
if (networkResolution.equals(NetworkResolution.AUTO)) {
EventBus eventBus = bucket.environment().eventBus();
// The Java client calls seedNodesFromConnectionString during bootstrap, but the results
// are not accessible here. Call it again.
Set<String> seedHosts = ConnectionStringUtil.seedNodesFromConnectionString(connectionString, true, tls, eventBus).stream().map(SeedNode::address).collect(toSet());
networkResolution = inferNetwork(config, networkResolution, seedHosts);
}
// Resolve alternate addresses
// so lambda can access it
NetworkResolution finalNetworkResolution = networkResolution;
return config.nodes().stream().map(node -> new ResolvedNodeInfo(node, tls, finalNetworkResolution)).map(node -> SeedNode.create(node.host(), node.port(KV), node.port(MANAGER))).filter(node -> node.kvPort().isPresent()).collect(toSet());
}
use of com.couchbase.client.core.service.ServiceType.KV in project kafka-connect-couchbase by couchbase.
the class SeedNodeHelper method getKvNodes.
/**
* Returns complete host and port information for every node running the KV service.
*/
public static Set<SeedNode> getKvNodes(Bucket bucket, String connectionString, boolean tls, NetworkResolution networkResolution, Duration timeout) {
// Bucket config is most reliable way to determine KV ports
BucketConfig config = CouchbaseHelper.getConfig(bucket, timeout);
// so the actual node names can be used.
if (networkResolution.equals(NetworkResolution.AUTO)) {
EventBus eventBus = bucket.environment().eventBus();
// The Java client calls seedNodesFromConnectionString during bootstrap, but the results
// are not accessible here. Call it again.
Set<String> seedHosts = ConnectionStringUtil.seedNodesFromConnectionString(connectionString, true, tls, eventBus).stream().map(SeedNode::address).collect(toSet());
networkResolution = inferNetwork(config, networkResolution, seedHosts);
}
// Resolve alternate addresses
// so lambda can access it
NetworkResolution finalNetworkResolution = networkResolution;
return config.nodes().stream().map(node -> new ResolvedNodeInfo(node, tls, finalNetworkResolution)).map(node -> SeedNode.create(node.host(), node.port(KV), node.port(MANAGER))).filter(node -> node.kvPort().isPresent()).collect(toSet());
}
Aggregations