Interface ProxyExtension

  • All Superinterfaces:
    java.lang.AutoCloseable

    @LimitedPrivate
    @Evolving
    public interface ProxyExtension
    extends java.lang.AutoCloseable
    The extension interface for support additional extensions on Pulsar Proxy.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean accept​(java.lang.String extension)
      Verify if the extension can handle the given extension name.
      void close()  
      java.lang.String extensionName()
      Returns the unique extension name.
      void initialize​(ProxyConfiguration conf)
      Initialize the extension when the extension is constructed from reflection.
      java.util.Map<java.net.InetSocketAddress,​io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>> newChannelInitializers()
      Create the list of channel initializers for the ports that this extension will listen on.
      void start​(ProxyService service)
      Start the extension with the provided proxy service.
    • Method Detail

      • extensionName

        java.lang.String extensionName()
        Returns the unique extension name. For example, `kafka-v2` for extension for Kafka v2 protocol.
      • accept

        boolean accept​(java.lang.String extension)
        Verify if the extension can handle the given extension name.
        Parameters:
        extension - the extension to verify
        Returns:
        true if the extension can handle the given extension name, otherwise false.
      • initialize

        void initialize​(ProxyConfiguration conf)
                 throws java.lang.Exception
        Initialize the extension when the extension is constructed from reflection.

        The initialize should initialize all the resources required for serving the extension but don't start those resources until start(ProxyService) is called.

        Parameters:
        conf - proxy service configuration
        Throws:
        java.lang.Exception - when fail to initialize the extension.
      • start

        void start​(ProxyService service)
        Start the extension with the provided proxy service.

        The proxy service provides the accesses to the Pulsar Proxy components.

        Parameters:
        service - the broker service to start with.
      • newChannelInitializers

        java.util.Map<java.net.InetSocketAddress,​io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>> newChannelInitializers()
        Create the list of channel initializers for the ports that this extension will listen on.

        NOTE: this method is called after start(ProxyService).

        Returns:
        the list of channel initializers for the ports that this extension listens on.
      • close

        void close()
        Specified by:
        close in interface java.lang.AutoCloseable