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, org.apache.bookkeeper.mledger.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.
      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.
    • 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
    • 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
    • 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.
    • 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