T
- type of the leader gatewayR
- type of the incoming requestM
- type of the message parameterspublic abstract class AbstractHandler<T extends RestfulGateway,R extends RequestBody,M extends MessageParameters> extends LeaderRetrievalHandler<T> implements AutoCloseableAsync
RequestBody
.
Subclasses must be thread-safe
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
protected static org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper |
MAPPER |
leaderRetriever, logger, responseHeaders, timeout
Modifier | Constructor and Description |
---|---|
protected |
AbstractHandler(GatewayRetriever<? extends T> leaderRetriever,
Time timeout,
Map<String,String> responseHeaders,
UntypedResponseMessageHeaders<R,M> untypedResponseMessageHeaders) |
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Void> |
closeAsync()
Trigger the closing of the resource and return the corresponding close future.
|
protected CompletableFuture<Void> |
closeHandlerAsync() |
protected void |
respondAsLeader(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
RoutedRequest routedRequest,
T gateway) |
protected abstract CompletableFuture<Void> |
respondToRequest(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx,
org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest,
HandlerRequest<R> handlerRequest,
T gateway)
Respond to the given
HandlerRequest . |
channelRead0, getTimeout
acceptInboundMessage, channelRead
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
protected final org.slf4j.Logger log
protected static final org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper MAPPER
protected void respondAsLeader(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx, RoutedRequest routedRequest, T gateway)
respondAsLeader
in class LeaderRetrievalHandler<T extends RestfulGateway>
public final CompletableFuture<Void> closeAsync()
AutoCloseableAsync
closeAsync
in interface AutoCloseableAsync
protected CompletableFuture<Void> closeHandlerAsync()
protected abstract CompletableFuture<Void> respondToRequest(org.apache.flink.shaded.netty4.io.netty.channel.ChannelHandlerContext ctx, org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpRequest httpRequest, HandlerRequest<R> handlerRequest, T gateway) throws RestHandlerException
HandlerRequest
.ctx
- channel handler context to write the responsehttpRequest
- original http requesthandlerRequest
- typed handler requestgateway
- leader gatewayRestHandlerException
- if an exception occurred while respondingCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.