T - type of the leader gatewayV - type of the operation resultM - type of the message headersprotected abstract class AbstractAsynchronousOperationHandlers.StatusHandler<T extends RestfulGateway,V,M extends MessageParameters> extends AbstractRestHandler<T,EmptyRequestBody,AsynchronousOperationResult<V>,M>
AsynchronousOperationResult which indicates whether the operation is still
in progress or has completed. In case that the operation has been completed, the AsynchronousOperationResult contains the operation result.log, MAPPERleaderRetriever, logger, responseHeaders, timeout| 限定符 | 构造器和说明 |
|---|---|
protected |
StatusHandler(GatewayRetriever<? extends T> leaderRetriever,
org.apache.flink.api.common.time.Time timeout,
Map<String,String> responseHeaders,
MessageHeaders<EmptyRequestBody,AsynchronousOperationResult<V>,M> messageHeaders) |
| 限定符和类型 | 方法和说明 |
|---|---|
CompletableFuture<Void> |
closeHandlerAsync() |
protected abstract V |
exceptionalOperationResultResponse(Throwable throwable)
Create an exceptional operation result from the given
Throwable. |
protected abstract K |
getOperationKey(HandlerRequest<EmptyRequestBody,M> request)
Extract the operation key under which the operation result future is stored.
|
CompletableFuture<AsynchronousOperationResult<V>> |
handleRequest(HandlerRequest<EmptyRequestBody,M> request,
T gateway)
This method is called for every incoming request and returns a
CompletableFuture
containing a the response. |
protected abstract V |
operationResultResponse(R operationResult)
Create the operation result from the given value.
|
getMessageHeaders, respondToRequestcloseAsync, respondAsLeaderchannelRead0acceptInboundMessage, channelReadchannelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharableprotected StatusHandler(GatewayRetriever<? extends T> leaderRetriever, org.apache.flink.api.common.time.Time timeout, Map<String,String> responseHeaders, MessageHeaders<EmptyRequestBody,AsynchronousOperationResult<V>,M> messageHeaders)
public CompletableFuture<AsynchronousOperationResult<V>> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody,M> request, @Nonnull T gateway) throws RestHandlerException
AbstractRestHandlerCompletableFuture
containing a the response.
Implementations may decide whether to throw RestHandlerExceptions or fail the
returned CompletableFuture with a RestHandlerException.
Failing the future with another exception type or throwing unchecked exceptions is
regarded as an implementation error as it does not allow us to provide a meaningful HTTP
status code. In this case a HttpResponseStatus.INTERNAL_SERVER_ERROR will be
returned.
handleRequest 在类中 AbstractRestHandler<T extends RestfulGateway,EmptyRequestBody,AsynchronousOperationResult<V>,M extends MessageParameters>request - request that should be handledgateway - leader gatewayRestHandlerException - if the handling failedpublic CompletableFuture<Void> closeHandlerAsync()
closeHandlerAsync 在类中 AbstractHandler<T extends RestfulGateway,EmptyRequestBody,M extends MessageParameters>protected abstract K getOperationKey(HandlerRequest<EmptyRequestBody,M> request)
request - with which the status handler has been calledprotected abstract V exceptionalOperationResultResponse(Throwable throwable)
Throwable. This method is
called if the asynchronous operation failed.throwable - failure of the asynchronous operationCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.