@Override protected void waitUntilReady() { log.info("Waiting for {} seconds for QUERY service", startupTimeout.getSeconds()); // try to connect to the URL try { retryUntilSuccess((int) startupTimeout.getSeconds(), TimeUnit.SECONDS, () -> { getRateLimiter().doWhenReady(() -> { GetClusterConfigResponse clusterConfig = bucket.core() .<GetClusterConfigResponse>send(new GetClusterConfigRequest()) .toBlocking().single(); boolean queryServiceEnabled = clusterConfig.config() .bucketConfig(bucket.name()) .serviceEnabled(ServiceType.QUERY); if (!queryServiceEnabled) { throw new ContainerLaunchException("Query service not ready yet"); } }); return true; }); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out waiting for QUERY service"); } } }
public static CouchbaseBucketConfig getBucketConfig(Bucket bucket) { final GetClusterConfigResponse response = (GetClusterConfigResponse) bucket.core().send( new GetClusterConfigRequest()).toBlocking().single(); return (CouchbaseBucketConfig) response.config().bucketConfig(bucket.name()); }
private NodeLocatorHelper(final Bucket bucket) { configProvider = bucket .core() .<GetConfigProviderResponse>send(new GetConfigProviderRequest()) .toBlocking() .single() .provider(); bucketConfig = new AtomicReference<BucketConfig>(configProvider.config().bucketConfig(bucket.name())); configProvider .configs() .filter(new Func1<ClusterConfig, Boolean>() { @Override public Boolean call(ClusterConfig clusterConfig) { return clusterConfig.hasBucket(bucket.name()); } }).subscribe(new Action1<ClusterConfig>() { @Override public void call(ClusterConfig config) { bucketConfig.set(config.bucketConfig(bucket.name())); } }); }
@Override protected void waitUntilReady() { logger().info("Waiting for {} seconds for QUERY service", startupTimeout.getSeconds()); // try to connect to the URL try { retryUntilSuccess((int) startupTimeout.getSeconds(), TimeUnit.SECONDS, () -> { getRateLimiter().doWhenReady(() -> { GetClusterConfigResponse clusterConfig = bucket.core() .<GetClusterConfigResponse>send(new GetClusterConfigRequest()) .toBlocking().single(); boolean queryServiceEnabled = clusterConfig.config() .bucketConfig(bucket.name()) .serviceEnabled(ServiceType.QUERY); if (!queryServiceEnabled) { throw new RuntimeException("Query service not ready yet"); } }); return true; }); } catch (TimeoutException e) { throw new ContainerLaunchException("Timed out waiting for QUERY service"); } } }