use of org.kie.kogito.index.service.DataIndexServiceException in project kogito-apps by kiegroup.
the class KogitoRuntimeClientImpl method sendGetClientRequest.
protected CompletableFuture sendGetClientRequest(WebClient webClient, String requestURI, String logMessage, Class type) {
CompletableFuture future = new CompletableFuture<>();
webClient.get(requestURI).putHeader("Authorization", getAuthHeader()).send(res -> {
if (res.succeeded() && (res.result().statusCode() == 200)) {
if (type != null) {
future.complete(res.result().bodyAsJson(type));
} else {
future.complete(res.result().bodyAsString());
}
} else {
future.completeExceptionally(new DataIndexServiceException(getErrorMessage(logMessage, res.result()), res.cause()));
}
});
return future;
}
Aggregations