Search in sources :

Example 6 with CoreHttpRequest

use of com.couchbase.client.core.endpoint.http.CoreHttpRequest in project couchbase-jvm-clients by couchbase.

the class HealthPinger method pingHttpEndpoint.

private static Mono<EndpointPingReport> pingHttpEndpoint(final Core core, final RequestTarget target, final CoreCommonOptions options, final String path) {
    return Mono.defer(() -> {
        CoreHttpRequest request = core.httpClient(target).get(path(path), options).build();
        core.send(request);
        return Reactor.wrap(request, request.response(), true).map(response -> {
            request.context().logicallyComplete();
            return assembleSuccessReport(request.context(), response.channelId(), Optional.empty());
        }).onErrorResume(throwable -> {
            request.context().logicallyComplete();
            return Mono.just(assembleFailureReport(throwable, request.context(), Optional.empty()));
        });
    });
}
Also used : ClusterConfig(com.couchbase.client.core.config.ClusterConfig) CbCollections.isNullOrEmpty(com.couchbase.client.core.util.CbCollections.isNullOrEmpty) CoreHttpRequest(com.couchbase.client.core.endpoint.http.CoreHttpRequest) TimeoutException(com.couchbase.client.core.error.TimeoutException) RequestTarget(com.couchbase.client.core.msg.RequestTarget) KvPingRequest(com.couchbase.client.core.msg.kv.KvPingRequest) CoreCommonOptions(com.couchbase.client.core.endpoint.http.CoreCommonOptions) HashSet(java.util.HashSet) ServiceType(com.couchbase.client.core.service.ServiceType) Duration(java.time.Duration) Map(java.util.Map) CoreHttpPath.path(com.couchbase.client.core.endpoint.http.CoreHttpPath.path) Stability(com.couchbase.client.core.annotation.Stability) RequestContext(com.couchbase.client.core.msg.RequestContext) BucketConfig(com.couchbase.client.core.config.BucketConfig) KvPingResponse(com.couchbase.client.core.msg.kv.KvPingResponse) Reactor(com.couchbase.client.core.Reactor) NodeInfo(com.couchbase.client.core.config.NodeInfo) Set(java.util.Set) Mono(reactor.core.publisher.Mono) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) Flux(reactor.core.publisher.Flux) Optional(java.util.Optional) CollectionIdentifier(com.couchbase.client.core.io.CollectionIdentifier) RetryStrategy(com.couchbase.client.core.retry.RetryStrategy) Core(com.couchbase.client.core.Core) PortInfo(com.couchbase.client.core.config.PortInfo) CoreHttpRequest(com.couchbase.client.core.endpoint.http.CoreHttpRequest)

Aggregations

CoreHttpRequest (com.couchbase.client.core.endpoint.http.CoreHttpRequest)6 Test (org.junit.jupiter.api.Test)4 Core (com.couchbase.client.core.Core)1 Reactor (com.couchbase.client.core.Reactor)1 Stability (com.couchbase.client.core.annotation.Stability)1 BucketConfig (com.couchbase.client.core.config.BucketConfig)1 ClusterConfig (com.couchbase.client.core.config.ClusterConfig)1 NodeInfo (com.couchbase.client.core.config.NodeInfo)1 PortInfo (com.couchbase.client.core.config.PortInfo)1 DefaultFullHttpResponse (com.couchbase.client.core.deps.io.netty.handler.codec.http.DefaultFullHttpResponse)1 FullHttpRequest (com.couchbase.client.core.deps.io.netty.handler.codec.http.FullHttpRequest)1 FullHttpResponse (com.couchbase.client.core.deps.io.netty.handler.codec.http.FullHttpResponse)1 BaseEndpoint (com.couchbase.client.core.endpoint.BaseEndpoint)1 CoreCommonOptions (com.couchbase.client.core.endpoint.http.CoreCommonOptions)1 CoreHttpClient (com.couchbase.client.core.endpoint.http.CoreHttpClient)1 CoreHttpPath.path (com.couchbase.client.core.endpoint.http.CoreHttpPath.path)1 CoreHttpResponse (com.couchbase.client.core.endpoint.http.CoreHttpResponse)1 HttpStatusCodeException (com.couchbase.client.core.error.HttpStatusCodeException)1 TimeoutException (com.couchbase.client.core.error.TimeoutException)1 CollectionIdentifier (com.couchbase.client.core.io.CollectionIdentifier)1