Class BrokerInterceptorWithClassLoader

java.lang.Object
org.apache.pulsar.broker.intercept.BrokerInterceptorWithClassLoader
All Implemented Interfaces:
AutoCloseable, BrokerInterceptor

public class BrokerInterceptorWithClassLoader extends Object implements BrokerInterceptor
A broker interceptor with it's classloader.
  • Constructor Details

    • BrokerInterceptorWithClassLoader

      public BrokerInterceptorWithClassLoader()
  • Method Details

    • beforeSendMessage

      public void beforeSendMessage(Subscription subscription, Entry entry, long[] ackSet, org.apache.pulsar.common.api.proto.MessageMetadata msgMetadata)
      Description copied from interface: BrokerInterceptor
      Intercept messages before sending them to the consumers. Deprecated, use BrokerInterceptor.beforeSendMessage(Subscription, Entry, long[], MessageMetadata, Consumer) instead.
      Specified by:
      beforeSendMessage in interface BrokerInterceptor
      Parameters:
      subscription - pulsar subscription
      entry - entry
      ackSet - entry ack bitset. it is either null or an array of long-based bitsets.
      msgMetadata - message metadata. The message metadata will be recycled after this call.
    • beforeSendMessage

      public void beforeSendMessage(Subscription subscription, Entry entry, long[] ackSet, org.apache.pulsar.common.api.proto.MessageMetadata msgMetadata, Consumer consumer)
      Description copied from interface: BrokerInterceptor
      Intercept messages before sending them to the consumers.
      Specified by:
      beforeSendMessage in interface BrokerInterceptor
      Parameters:
      subscription - pulsar subscription
      entry - entry
      ackSet - entry ack bitset. it is either null or an array of long-based bitsets.
      msgMetadata - message metadata. The message metadata will be recycled after this call.
      consumer - consumer. Consumer which entry are sent to.
    • onMessagePublish

      public void onMessagePublish(Producer producer, io.netty.buffer.ByteBuf headersAndPayload, Topic.PublishContext publishContext)
      Description copied from interface: BrokerInterceptor
      Intercept message when broker receive a send request.
      Specified by:
      onMessagePublish in interface BrokerInterceptor
      headersAndPayload - entry's header and payload
      publishContext - Publish Context
    • producerCreated

      public void producerCreated(ServerCnx cnx, Producer producer, Map<String,String> metadata)
      Description copied from interface: BrokerInterceptor
      Called by the broker when a new connection is created.
      Specified by:
      producerCreated in interface BrokerInterceptor
    • producerClosed

      public void producerClosed(ServerCnx cnx, Producer producer, Map<String,String> metadata)
      Description copied from interface: BrokerInterceptor
      Called by the broker when a producer is closed.
      Specified by:
      producerClosed in interface BrokerInterceptor
      Parameters:
      cnx - client Connection
      producer - Producer object
      metadata - A map of metadata
    • consumerCreated

      public void consumerCreated(ServerCnx cnx, Consumer consumer, Map<String,String> metadata)
      Description copied from interface: BrokerInterceptor
      Intercept after a consumer is created.
      Specified by:
      consumerCreated in interface BrokerInterceptor
      Parameters:
      cnx - client Connection
      consumer - Consumer object
      metadata - A map of metadata
    • consumerClosed

      public void consumerClosed(ServerCnx cnx, Consumer consumer, Map<String,String> metadata)
      Description copied from interface: BrokerInterceptor
      Called by the broker when a consumer is closed.
      Specified by:
      consumerClosed in interface BrokerInterceptor
      Parameters:
      cnx - client Connection
      consumer - Consumer object
      metadata - A map of metadata
    • messageProduced

      public void messageProduced(ServerCnx cnx, Producer producer, long startTimeNs, long ledgerId, long entryId, Topic.PublishContext publishContext)
      Description copied from interface: BrokerInterceptor
      Intercept after a message is produced.
      Specified by:
      messageProduced in interface BrokerInterceptor
      Parameters:
      cnx - client Connection
      producer - Producer object
      publishContext - Publish Context
    • messageDispatched

      public void messageDispatched(ServerCnx cnx, Consumer consumer, long ledgerId, long entryId, io.netty.buffer.ByteBuf headersAndPayload)
      Description copied from interface: BrokerInterceptor
      Intercept after a message is dispatched to consumer.
      Specified by:
      messageDispatched in interface BrokerInterceptor
      Parameters:
      cnx - client Connection
      consumer - Consumer object
      ledgerId - Ledger ID
      entryId - Entry ID
      headersAndPayload - Data
    • messageAcked

      public void messageAcked(ServerCnx cnx, Consumer consumer, org.apache.pulsar.common.api.proto.CommandAck ackCmd)
      Description copied from interface: BrokerInterceptor
      Intercept after a message ack is processed.
      Specified by:
      messageAcked in interface BrokerInterceptor
      Parameters:
      cnx - client Connection
      ackCmd - Command object
    • txnOpened

      public void txnOpened(long tcId, String txnID)
      Description copied from interface: BrokerInterceptor
      Intercept when a transaction begins.
      Specified by:
      txnOpened in interface BrokerInterceptor
      Parameters:
      tcId - Transaction Coordinator Id
      txnID - Transaction ID
    • txnEnded

      public void txnEnded(String txnID, long txnAction)
      Description copied from interface: BrokerInterceptor
      Intercept when a transaction ends.
      Specified by:
      txnEnded in interface BrokerInterceptor
      Parameters:
      txnID - Transaction ID
      txnAction - Transaction Action
    • onConnectionCreated

      public void onConnectionCreated(ServerCnx cnx)
      Description copied from interface: BrokerInterceptor
      Called by the broker when a new connection is created.
      Specified by:
      onConnectionCreated in interface BrokerInterceptor
    • onPulsarCommand

      public void onPulsarCommand(org.apache.pulsar.common.api.proto.BaseCommand command, ServerCnx cnx) throws org.apache.pulsar.common.intercept.InterceptException
      Description copied from interface: BrokerInterceptor
      Called by the broker while new command incoming.
      Specified by:
      onPulsarCommand in interface BrokerInterceptor
      Throws:
      org.apache.pulsar.common.intercept.InterceptException
    • onConnectionClosed

      public void onConnectionClosed(ServerCnx cnx)
      Description copied from interface: BrokerInterceptor
      Called by the broker while connection closed.
      Specified by:
      onConnectionClosed in interface BrokerInterceptor
    • onWebserviceRequest

      public void onWebserviceRequest(javax.servlet.ServletRequest request) throws IOException, javax.servlet.ServletException, org.apache.pulsar.common.intercept.InterceptException
      Description copied from interface: BrokerInterceptor
      Called by the web service while new request incoming.
      Specified by:
      onWebserviceRequest in interface BrokerInterceptor
      Throws:
      IOException
      javax.servlet.ServletException
      org.apache.pulsar.common.intercept.InterceptException
    • onWebserviceResponse

      public void onWebserviceResponse(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws IOException, javax.servlet.ServletException
      Description copied from interface: BrokerInterceptor
      Intercept the webservice response before send to client.
      Specified by:
      onWebserviceResponse in interface BrokerInterceptor
      Throws:
      IOException
      javax.servlet.ServletException
    • initialize

      public void initialize(PulsarService pulsarService) throws Exception
      Description copied from interface: BrokerInterceptor
      Initialize the broker interceptor.
      Specified by:
      initialize in interface BrokerInterceptor
      Throws:
      Exception - when fail to initialize the broker interceptor.
    • onFilter

      public void onFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws javax.servlet.ServletException, IOException
      Description copied from interface: BrokerInterceptor
      The interception of web processing, as same as `Filter.onFilter`. So In this method, we must call `chain.doFilter` to continue the chain.
      Specified by:
      onFilter in interface BrokerInterceptor
      Throws:
      javax.servlet.ServletException
      IOException
    • close

      public void close()
      Description copied from interface: BrokerInterceptor
      Close this broker interceptor.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface BrokerInterceptor
    • getInterceptor

      public BrokerInterceptor getInterceptor()