Package io.kroxylicious.proxy.internal
Class KafkaProxyBackendHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.kroxylicious.proxy.internal.KafkaProxyBackendHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
public class KafkaProxyBackendHandler
extends io.netty.channel.ChannelInboundHandlerAdapter
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelActive(io.netty.channel.ChannelHandlerContext ctx) Netty callback that upstream/server channel has successfully connected to the remote peer.voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) Netty callback to notify that the upstream/server channel TCP connection has disconnected.voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) Netty callback that something has been read from the upstream/server channel.voidchannelReadComplete(io.netty.channel.ChannelHandlerContext ctx) Invoked when the last message read by the current read operation has been consumed bychannelRead(ChannelHandlerContext, Object).voidchannelRegistered(io.netty.channel.ChannelHandlerContext ctx) Netty callback that resources have been allocated for the channel.voidchannelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) Propagates backpressure to the downstream/client connection by notifying theServerConnectionStateMachinewhen the upstream/server connection blocks or unblocks.voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) Netty callback indicating that an exception reached it.toString()voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object event) Netty callback.Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
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
-
Method Details
-
channelWritabilityChanged
Propagates backpressure to the downstream/client connection by notifying theServerConnectionStateMachinewhen the upstream/server connection blocks or unblocks.- Specified by:
channelWritabilityChangedin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelWritabilityChangedin classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- the handler context for upstream/server channel- Throws:
Exception- If something went wrong
-
channelRegistered
Netty callback that resources have been allocated for the channel. This is the first point at which we become aware of the upstream/server channel.- Specified by:
channelRegisteredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelRegisteredin classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- the context for the upstream/server channel.- Throws:
Exception- If something went wrong.
-
channelActive
Netty callback that upstream/server channel has successfully connected to the remote peer. This does not mean that the channel is usable by the proxy as TLS negotiation, if required, is still in progress.- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- the context for the upstream/server channel.- Throws:
Exception- If something went wrong.
-
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 the SSL Handshake 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.
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) Netty callback to notify that the upstream/server channel TCP connection has disconnected.- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- The context for the upstream/server channel.
-
exceptionCaught
Netty callback indicating that an exception reached it. Which means the proxy should give up as all hope for this connection is lost.- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- The context for the upstream/server channel.cause- The exception which reached netty.
-
channelRead
Netty callback that something has been read from the upstream/server channel. There may be further calls to this method before a call tochannelReadComplete()signals the end of the current read operation.- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- The context for the upstream/server channel.msg- the message read from the channel.
-
channelReadComplete
Invoked when the last message read by the current read operation has been consumed by
This allows the proxy to batch requests.channelRead(ChannelHandlerContext, Object).- Specified by:
channelReadCompletein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadCompletein classio.netty.channel.ChannelInboundHandlerAdapter- Parameters:
ctx- The upstream/server context- Throws:
Exception
-
toString
-