Class PulsarHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
org.apache.pulsar.common.protocol.PulsarDecoder
org.apache.pulsar.common.protocol.PulsarHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public abstract class PulsarHandler extends PulsarDecoder
Implementation of the channel handler to process inbound Pulsar data.

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

  • Field Details

    • ctx

      protected io.netty.channel.ChannelHandlerContext ctx
    • remoteAddress

      protected SocketAddress remoteAddress
  • Constructor Details

    • PulsarHandler

      public PulsarHandler(int keepAliveInterval, TimeUnit unit)
  • Method Details

    • getRemoteEndpointProtocolVersion

      public int getRemoteEndpointProtocolVersion()
    • setRemoteEndpointProtocolVersion

      protected void setRemoteEndpointProtocolVersion(int remoteEndpointProtocolVersion)
    • messageReceived

      protected void messageReceived()
      Specified by:
      messageReceived in class PulsarDecoder
    • channelActive

      public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
      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 io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception
    • handlePing

      protected final void handlePing(CommandPing ping)
      Overrides:
      handlePing in class PulsarDecoder
    • handlePong

      protected final void handlePong(CommandPong pong)
      Overrides:
      handlePong in class PulsarDecoder
    • sendPing

      protected io.netty.channel.ChannelFuture sendPing()
    • cancelKeepAliveTask

      public void cancelKeepAliveTask()
    • isHandshakeCompleted

      protected abstract boolean isHandshakeCompleted()
      Returns:
      true if the connection is ready to use, meaning the Pulsar handshake was already completed