Search in sources :

Example 1 with CarrierGlobalConfigRequest

use of com.couchbase.client.core.msg.kv.CarrierGlobalConfigRequest in project couchbase-jvm-clients by couchbase.

the class GlobalRefresher method attemptUpdateGlobalConfig.

private Flux<ProposedGlobalConfigContext> attemptUpdateGlobalConfig(final Flux<PortInfo> nodes) {
    return nodes.flatMap(nodeInfo -> {
        CoreContext ctx = core.context();
        CarrierGlobalConfigRequest request = new CarrierGlobalConfigRequest(configRequestTimeout, ctx, FailFastRetryStrategy.INSTANCE, nodeInfo.identifier());
        core.send(request);
        return Reactor.wrap(request, request.response(), true).filter(response -> {
            // TODO: debug event that it got ignored.
            return response.status().success();
        }).map(response -> new ProposedGlobalConfigContext(new String(response.content(), UTF_8), nodeInfo.hostname())).onErrorResume(t -> {
            // TODO: raise a warning that fetching a config individual failed.
            return Mono.empty();
        });
    });
}
Also used : Disposable(reactor.core.Disposable) Reactor(com.couchbase.client.core.Reactor) UTF_8(java.nio.charset.StandardCharsets.UTF_8) GlobalConfig(com.couchbase.client.core.config.GlobalConfig) Mono(reactor.core.publisher.Mono) ProposedGlobalConfigContext(com.couchbase.client.core.config.ProposedGlobalConfigContext) KeyValueBucketRefresher.clampConfigRequestTimeout(com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.clampConfigRequestTimeout) CarrierGlobalConfigRequest(com.couchbase.client.core.msg.kv.CarrierGlobalConfigRequest) FailFastRetryStrategy(com.couchbase.client.core.retry.FailFastRetryStrategy) ArrayList(java.util.ArrayList) Flux(reactor.core.publisher.Flux) AtomicLong(java.util.concurrent.atomic.AtomicLong) MAX_PARALLEL_FETCH(com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.MAX_PARALLEL_FETCH) List(java.util.List) POLLER_INTERVAL(com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.POLLER_INTERVAL) ServiceType(com.couchbase.client.core.service.ServiceType) CoreContext(com.couchbase.client.core.CoreContext) Duration(java.time.Duration) Core(com.couchbase.client.core.Core) ConfigurationProvider(com.couchbase.client.core.config.ConfigurationProvider) PortInfo(com.couchbase.client.core.config.PortInfo) CoreContext(com.couchbase.client.core.CoreContext) CarrierGlobalConfigRequest(com.couchbase.client.core.msg.kv.CarrierGlobalConfigRequest) ProposedGlobalConfigContext(com.couchbase.client.core.config.ProposedGlobalConfigContext)

Aggregations

Core (com.couchbase.client.core.Core)1 CoreContext (com.couchbase.client.core.CoreContext)1 Reactor (com.couchbase.client.core.Reactor)1 ConfigurationProvider (com.couchbase.client.core.config.ConfigurationProvider)1 GlobalConfig (com.couchbase.client.core.config.GlobalConfig)1 PortInfo (com.couchbase.client.core.config.PortInfo)1 ProposedGlobalConfigContext (com.couchbase.client.core.config.ProposedGlobalConfigContext)1 MAX_PARALLEL_FETCH (com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.MAX_PARALLEL_FETCH)1 POLLER_INTERVAL (com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.POLLER_INTERVAL)1 KeyValueBucketRefresher.clampConfigRequestTimeout (com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.clampConfigRequestTimeout)1 CarrierGlobalConfigRequest (com.couchbase.client.core.msg.kv.CarrierGlobalConfigRequest)1 FailFastRetryStrategy (com.couchbase.client.core.retry.FailFastRetryStrategy)1 ServiceType (com.couchbase.client.core.service.ServiceType)1 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Disposable (reactor.core.Disposable)1 Flux (reactor.core.publisher.Flux)1