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

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Forward a message towards the Filter Chain
    void
    channelActive(io.netty.channel.ChannelHandlerContext ctx)
    Netty callback to notify that the downstream/client channel has an active TCP connection.
    io.netty.channel.ChannelId
    Get the ID of the frontend channel if available.
    void
    channelInactive(io.netty.channel.ChannelHandlerContext ctx)
    Netty callback to notify that the downstream/client channel TCP connection has disconnected.
    void
    channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
    Netty callback that something has been read from the downstream/client channel.
    void
    channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)
    Propagates backpressure to the upstream/server connection by notifying the ClientConnectionStateMachine when the downstream/client connection blocks or unblocks.
    void
    exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
    Handles an exception in downstream/client pipeline by notifying clientConnectionStateMachine of the issue.
    void
     
    protected String
     
    protected int
     
     
    void
    userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object event)
    Netty callback.

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelReadComplete, channelRegistered, channelUnregistered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods 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

      public String toString()
      Overrides:
      toString in class Object
    • 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:
      userEventTriggered in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      userEventTriggered in class io.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

      public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Netty callback to notify that the downstream/client channel has an active TCP connection.
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class io.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:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class io.netty.channel.ChannelInboundHandlerAdapter
      Parameters:
      ctx - The context for the downstream/client channel.
    • channelWritabilityChanged

      public void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Propagates backpressure to the upstream/server connection by notifying the ClientConnectionStateMachine when the downstream/client connection blocks or unblocks.
      Specified by:
      channelWritabilityChanged in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelWritabilityChanged in class io.netty.channel.ChannelInboundHandlerAdapter
      Parameters:
      ctx - the handler context for downstream/client channel
      Throws:
      Exception - If something went wrong
    • channelRead

      public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
      Netty callback that something has been read from the downstream/client channel.
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
      Parameters:
      ctx - The context for the downstream/client channel.
      msg - the message read from the channel.
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
      Handles an exception in downstream/client pipeline by notifying clientConnectionStateMachine of the issue.
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter
      Parameters:
      ctx - The downstream context
      cause - The downstream exception
    • channelId

      @CheckReturnValue @Nullable public io.netty.channel.ChannelId channelId()
      Get the ID of the frontend channel if available.
      Returns:
      null if the channel is not yet available
    • onSessionAuthenticated

      public void onSessionAuthenticated()
    • remoteHost

      protected String remoteHost()
    • remotePort

      protected int remotePort()
    • admitToFilterChain

      public void admitToFilterChain(Object msg)
      Forward a message towards the Filter Chain
      Parameters:
      msg - message