use of org.apache.flink.runtime.rest.messages.job.coordination.ClientCoordinationResponseBody in project flink by apache.
the class ClientCoordinationHandler method handleRequest.
@Override
protected CompletableFuture<ClientCoordinationResponseBody> handleRequest(@Nonnull HandlerRequest<ClientCoordinationRequestBody> request, @Nonnull RestfulGateway gateway) throws RestHandlerException {
JobID jobId = request.getPathParameter(JobIDPathParameter.class);
OperatorID operatorId = request.getPathParameter(OperatorIDPathParameter.class);
SerializedValue<CoordinationRequest> serializedRequest = request.getRequestBody().getSerializedCoordinationRequest();
CompletableFuture<CoordinationResponse> responseFuture = gateway.deliverCoordinationRequestToCoordinator(jobId, operatorId, serializedRequest, timeout);
return responseFuture.thenApply(coordinationResponse -> {
try {
return new ClientCoordinationResponseBody(new SerializedValue<>(coordinationResponse));
} catch (IOException e) {
throw new CompletionException(new RestHandlerException("Failed to serialize coordination response", HttpResponseStatus.INTERNAL_SERVER_ERROR, e));
}
});
}
Aggregations