Class BrokerInterceptorWithClassLoader
- java.lang.Object
-
- org.apache.pulsar.broker.intercept.BrokerInterceptorWithClassLoader
-
- All Implemented Interfaces:
java.lang.AutoCloseable,BrokerInterceptor
public class BrokerInterceptorWithClassLoader extends java.lang.Object implements BrokerInterceptor
A broker interceptor with it's classloader.
-
-
Constructor Summary
Constructors Constructor Description BrokerInterceptorWithClassLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeSendMessage(Subscription subscription, org.apache.bookkeeper.mledger.Entry entry, long[] ackSet, org.apache.pulsar.common.api.proto.MessageMetadata msgMetadata)Intercept messages before sending them to the consumers.voidclose()Close this broker interceptor.voidconsumerCreated(ServerCnx cnx, Consumer consumer, java.util.Map<java.lang.String,java.lang.String> metadata)Intercept after a consumer is created.voidinitialize(PulsarService pulsarService)Initialize the broker interceptor.voidmessageAcked(ServerCnx cnx, Consumer consumer, org.apache.pulsar.common.api.proto.CommandAck ackCmd)Intercept after a message ack is processed.voidmessageDispatched(ServerCnx cnx, Consumer consumer, long ledgerId, long entryId, io.netty.buffer.ByteBuf headersAndPayload)Intercept after a message is dispatched to consumer.voidmessageProduced(ServerCnx cnx, Producer producer, long startTimeNs, long ledgerId, long entryId, Topic.PublishContext publishContext)Intercept after a message is produced.voidonConnectionClosed(ServerCnx cnx)Called by the broker while connection closed.voidonConnectionCreated(ServerCnx cnx)Called by the broker when a new connection is created.voidonPulsarCommand(org.apache.pulsar.common.api.proto.BaseCommand command, ServerCnx cnx)Called by the broker while new command incoming.voidonWebserviceRequest(javax.servlet.ServletRequest request)Called by the web service while new request incoming.voidonWebserviceResponse(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)Intercept the webservice response before send to client.voidproducerCreated(ServerCnx cnx, Producer producer, java.util.Map<java.lang.String,java.lang.String> metadata)Called by the broker when a new connection is created.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pulsar.broker.intercept.BrokerInterceptor
onFilter
-
-
-
-
Method Detail
-
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:BrokerInterceptorIntercept messages before sending them to the consumers.- Specified by:
beforeSendMessagein interfaceBrokerInterceptor- Parameters:
subscription- pulsar subscriptionentry- entryackSet- 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, java.util.Map<java.lang.String,java.lang.String> metadata)
Description copied from interface:BrokerInterceptorCalled by the broker when a new connection is created.- Specified by:
producerCreatedin interfaceBrokerInterceptor
-
consumerCreated
public void consumerCreated(ServerCnx cnx, Consumer consumer, java.util.Map<java.lang.String,java.lang.String> metadata)
Description copied from interface:BrokerInterceptorIntercept after a consumer is created.- Specified by:
consumerCreatedin interfaceBrokerInterceptor- Parameters:
cnx- client Connectionconsumer- Consumer objectmetadata- A map of metdata
-
messageProduced
public void messageProduced(ServerCnx cnx, Producer producer, long startTimeNs, long ledgerId, long entryId, Topic.PublishContext publishContext)
Description copied from interface:BrokerInterceptorIntercept after a message is produced.- Specified by:
messageProducedin interfaceBrokerInterceptor- Parameters:
cnx- client Connectionproducer- Producer objectpublishContext- Publish Context
-
messageDispatched
public void messageDispatched(ServerCnx cnx, Consumer consumer, long ledgerId, long entryId, io.netty.buffer.ByteBuf headersAndPayload)
Description copied from interface:BrokerInterceptorIntercept after a message is dispatched to consumer.- Specified by:
messageDispatchedin interfaceBrokerInterceptor- Parameters:
cnx- client Connectionconsumer- Consumer objectledgerId- Ledger IDentryId- Entry IDheadersAndPayload- Data
-
messageAcked
public void messageAcked(ServerCnx cnx, Consumer consumer, org.apache.pulsar.common.api.proto.CommandAck ackCmd)
Description copied from interface:BrokerInterceptorIntercept after a message ack is processed.- Specified by:
messageAckedin interfaceBrokerInterceptor- Parameters:
cnx- client ConnectionackCmd- Command object
-
onConnectionCreated
public void onConnectionCreated(ServerCnx cnx)
Description copied from interface:BrokerInterceptorCalled by the broker when a new connection is created.- Specified by:
onConnectionCreatedin interfaceBrokerInterceptor
-
onPulsarCommand
public void onPulsarCommand(org.apache.pulsar.common.api.proto.BaseCommand command, ServerCnx cnx) throws org.apache.pulsar.common.intercept.InterceptExceptionDescription copied from interface:BrokerInterceptorCalled by the broker while new command incoming.- Specified by:
onPulsarCommandin interfaceBrokerInterceptor- Throws:
org.apache.pulsar.common.intercept.InterceptException
-
onConnectionClosed
public void onConnectionClosed(ServerCnx cnx)
Description copied from interface:BrokerInterceptorCalled by the broker while connection closed.- Specified by:
onConnectionClosedin interfaceBrokerInterceptor
-
onWebserviceRequest
public void onWebserviceRequest(javax.servlet.ServletRequest request) throws java.io.IOException, javax.servlet.ServletException, org.apache.pulsar.common.intercept.InterceptExceptionDescription copied from interface:BrokerInterceptorCalled by the web service while new request incoming.- Specified by:
onWebserviceRequestin interfaceBrokerInterceptor- Throws:
java.io.IOExceptionjavax.servlet.ServletExceptionorg.apache.pulsar.common.intercept.InterceptException
-
onWebserviceResponse
public void onWebserviceResponse(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws java.io.IOException, javax.servlet.ServletExceptionDescription copied from interface:BrokerInterceptorIntercept the webservice response before send to client.- Specified by:
onWebserviceResponsein interfaceBrokerInterceptor- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
initialize
public void initialize(PulsarService pulsarService) throws java.lang.Exception
Description copied from interface:BrokerInterceptorInitialize the broker interceptor.- Specified by:
initializein interfaceBrokerInterceptor- Throws:
java.lang.Exception- when fail to initialize the broker interceptor.
-
close
public void close()
Description copied from interface:BrokerInterceptorClose this broker interceptor.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceBrokerInterceptor
-
-