use of com.couchbase.client.core.msg.RequestTarget in project couchbase-jvm-clients by couchbase.
the class HealthPinger method pingKv.
private static Mono<EndpointPingReport> pingKv(final Core core, final RequestTarget target, final CoreCommonOptions options) {
return Mono.defer(() -> {
Duration timeout = options.timeout().orElse(core.context().environment().timeoutConfig().kvTimeout());
CollectionIdentifier collectionIdentifier = CollectionIdentifier.fromDefault(target.bucketName());
KvPingRequest request = new KvPingRequest(timeout, core.context(), options.retryStrategy().orElse(null), collectionIdentifier, target.nodeIdentifier());
core.send(request);
return Reactor.wrap(request, request.response(), true).map(response -> {
request.context().logicallyComplete();
return assembleSuccessReport(request.context(), ((KvPingResponse) response).channelId(), Optional.ofNullable(target.bucketName()));
}).onErrorResume(throwable -> {
request.context().logicallyComplete();
return Mono.just(assembleFailureReport(throwable, request.context(), Optional.ofNullable(target.bucketName())));
});
});
}
use of com.couchbase.client.core.msg.RequestTarget 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()));
});
});
}
Aggregations