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 org.apache.flink.util.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,
org.apache.flink.api.common.time.Time timeout,
Map<String,String> responseHeaders,
UntypedResponseMessageHeaders<R,M> untypedResponseMessageHeaders) |
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Void> |
closeAsync() |
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,M> handlerRequest,
T gateway)
Respond to the given
HandlerRequest . |
channelRead0
acceptInboundMessage, channelRead
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
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()
closeAsync
in interface org.apache.flink.util.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,M> 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–2022 The Apache Software Foundation. All rights reserved.