Search in sources :

Example 1 with DataIndexServiceException

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;
}
Also used : DataIndexServiceException(org.kie.kogito.index.service.DataIndexServiceException) CompletableFuture(java.util.concurrent.CompletableFuture)

Aggregations

CompletableFuture (java.util.concurrent.CompletableFuture)1 DataIndexServiceException (org.kie.kogito.index.service.DataIndexServiceException)1