use of org.apache.flink.runtime.rest.messages.job.coordination.ClientCoordinationHeaders in project flink by apache.
the class RestClusterClient method sendCoordinationRequest.
@Override
public CompletableFuture<CoordinationResponse> sendCoordinationRequest(JobID jobId, OperatorID operatorId, CoordinationRequest request) {
ClientCoordinationHeaders headers = ClientCoordinationHeaders.getInstance();
ClientCoordinationMessageParameters params = new ClientCoordinationMessageParameters();
params.jobPathParameter.resolve(jobId);
params.operatorPathParameter.resolve(operatorId);
SerializedValue<CoordinationRequest> serializedRequest;
try {
serializedRequest = new SerializedValue<>(request);
} catch (IOException e) {
return FutureUtils.completedExceptionally(e);
}
ClientCoordinationRequestBody requestBody = new ClientCoordinationRequestBody(serializedRequest);
return sendRequest(headers, params, requestBody).thenApply(responseBody -> {
try {
return responseBody.getSerializedCoordinationResponse().deserializeValue(getClass().getClassLoader());
} catch (IOException | ClassNotFoundException e) {
throw new CompletionException("Failed to deserialize coordination response", e);
}
});
}
Aggregations