Class ProxyConnection

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public class ProxyConnection extends PulsarHandler
Handles incoming discovery request from client and sends appropriate response back to client.

Please see PulsarDecoder javadoc for important details about handle* method parameter instance lifecycle.

  • Field Details

    • SPLICE_BYTES

      protected static final Integer SPLICE_BYTES
  • Constructor Details

    • ProxyConnection

      public ProxyConnection(ProxyService proxyService, io.netty.resolver.dns.DnsAddressResolverGroup dnsAddressResolverGroup)
  • Method Details

    • channelRegistered

      public void channelRegistered(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelRegistered in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRegistered in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelUnregistered

      public void channelUnregistered(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelUnregistered in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelUnregistered in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelActive

      public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class PulsarHandler
      Throws:
      Exception
    • channelInactive

      public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelInactive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelInactive in class PulsarHandler
      Throws:
      Exception
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
      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
      Throws:
      Exception
    • channelWritabilityChanged

      public void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelWritabilityChanged in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelWritabilityChanged in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • channelRead

      public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class PulsarDecoder
      Throws:
      Exception
    • spliceNIC2NIC

      protected static io.netty.channel.ChannelPromise spliceNIC2NIC(io.netty.channel.epoll.EpollSocketChannel inboundChannel, io.netty.channel.epoll.EpollSocketChannel outboundChannel, int spliceLength)
      Use splice to zero-copy of NIC to NIC.
      Parameters:
      inboundChannel - input channel
      outboundChannel - output channel
    • isTlsChannel

      protected static boolean isTlsChannel(io.netty.channel.Channel channel)
    • brokerConnected

      public void brokerConnected(DirectProxyHandler directProxyHandler, CommandConnected connected)
    • authenticationFailedCallback

      protected void authenticationFailedCallback(Throwable t)
    • authChallengeSuccessCallback

      protected void authChallengeSuccessCallback(org.apache.pulsar.common.api.AuthData authChallenge)
    • handleConnect

      protected void handleConnect(CommandConnect connect)
      Overrides:
      handleConnect in class PulsarDecoder
    • handleAuthResponse

      protected void handleAuthResponse(CommandAuthResponse authResponse)
      Overrides:
      handleAuthResponse in class PulsarDecoder
    • handlePartitionMetadataRequest

      protected void handlePartitionMetadataRequest(CommandPartitionedTopicMetadata partitionMetadata)
      Overrides:
      handlePartitionMetadataRequest in class PulsarDecoder
    • handleGetTopicsOfNamespace

      protected void handleGetTopicsOfNamespace(CommandGetTopicsOfNamespace commandGetTopicsOfNamespace)
      Overrides:
      handleGetTopicsOfNamespace in class PulsarDecoder
    • handleGetSchema

      protected void handleGetSchema(CommandGetSchema commandGetSchema)
      Overrides:
      handleGetSchema in class PulsarDecoder
    • handleLookup

      protected void handleLookup(CommandLookupTopic lookup)
      handles discovery request from client ands sends next active broker address.
      Overrides:
      handleLookup in class PulsarDecoder
    • getClientAuthentication

      public Authentication getClientAuthentication()
    • isHandshakeCompleted

      protected boolean isHandshakeCompleted()
      Specified by:
      isHandshakeCompleted in class PulsarHandler
    • hasHAProxyMessage

      public boolean hasHAProxyMessage()
    • getHAProxyMessage

      public io.netty.handler.codec.haproxy.HAProxyMessage getHAProxyMessage()