Package io.kroxylicious.proxy.internal
Class KafkaProxyFrontendHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.kroxylicious.proxy.internal.KafkaProxyFrontendHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
public class KafkaProxyFrontendHandler
extends io.netty.channel.ChannelInboundHandlerAdapter
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidadmitToFilterChain(Object msg) Forward a message towards the Filter ChainvoidchannelActive(io.netty.channel.ChannelHandlerContext ctx) Netty callback to notify that the downstream/client channel has an active TCP connection.io.netty.channel.ChannelIdGet the ID of the frontend channel if available.voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) Netty callback to notify that the downstream/client channel TCP connection has disconnected.voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) Netty callback that something has been read from the downstream/client channel.voidchannelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) Propagates backpressure to the upstream/server connection by notifying theClientConnectionStateMachinewhen the downstream/client connection blocks or unblocks.voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) Handles an exception in downstream/client pipeline by notifyingclientConnectionStateMachineof the issue.voidprotected Stringprotected inttoString()voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object event) Netty callback.Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregisteredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
DEFAULT_IDLE_TIME_SECONDS
public static final int DEFAULT_IDLE_TIME_SECONDS- See Also:
-
DEFAULT_IDLE_SECONDS
public static final long DEFAULT_IDLE_SECONDS- See Also:
-
-
Method Details
-
toString
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object event) throws Exception Netty callback. Used to notify us of custom events. Events such as ServerNameIndicator (SNI) resolution completing.
This method is called for every custom event, so its up to us to filter out the ones we care about.- Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- the channel handler context on which the event was triggered.event- the information being notified- Throws:
Exception- any errors in processing.
-
channelActive
Netty callback to notify that the downstream/client channel has an active TCP connection.- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- the handler context for downstream/client channel- Throws:
Exception- if we object to the client...
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) Netty callback to notify that the downstream/client channel TCP connection has disconnected.- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- The context for the downstream/client channel.
-
channelWritabilityChanged
Propagates backpressure to the upstream/server connection by notifying theClientConnectionStateMachinewhen the downstream/client connection blocks or unblocks.- Specified by:
channelWritabilityChangedin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelWritabilityChangedin classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- the handler context for downstream/client channel- Throws:
Exception- If something went wrong
-
channelRead
Netty callback that something has been read from the downstream/client channel.- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- The context for the downstream/client channel.msg- the message read from the channel.
-
exceptionCaught
Handles an exception in downstream/client pipeline by notifyingclientConnectionStateMachineof the issue.- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- The downstream contextcause- The downstream exception
-
channelId
@CheckReturnValue @Nullable public io.netty.channel.ChannelId channelId()Get the ID of the frontend channel if available.- Returns:
nullif the channel is not yet available
-
onSessionAuthenticated
public void onSessionAuthenticated() -
remoteHost
-
remotePort
protected int remotePort() -
admitToFilterChain
Forward a message towards the Filter Chain- Parameters:
msg- message
-