public class BrokerInterceptors extends Object implements BrokerInterceptor
BrokerInterceptor.BrokerInterceptorDisabledDISABLED| Constructor and Description |
|---|
BrokerInterceptors(Map<String,BrokerInterceptorWithClassLoader> interceptors) |
| Modifier and Type | Method and Description |
|---|---|
void |
beforeSendMessage(Subscription subscription,
Entry entry,
long[] ackSet,
org.apache.pulsar.common.api.proto.MessageMetadata msgMetadata)
Intercept messages before sending them to the consumers.
|
void |
close()
Close this broker interceptor.
|
void |
consumerCreated(ServerCnx cnx,
Consumer consumer,
Map<String,String> metadata)
Intercept after a consumer is created.
|
void |
initialize(PulsarService pulsarService)
Initialize the broker interceptor.
|
static BrokerInterceptor |
load(ServiceConfiguration conf)
Load the broker event interceptor for the given interceptor list.
|
void |
messageAcked(ServerCnx cnx,
Consumer consumer,
org.apache.pulsar.common.api.proto.CommandAck ackCmd)
Intercept after a message ack is processed.
|
void |
messageDispatched(ServerCnx cnx,
Consumer consumer,
long ledgerId,
long entryId,
io.netty.buffer.ByteBuf headersAndPayload)
Intercept after a message is dispatched to consumer.
|
void |
messageProduced(ServerCnx cnx,
Producer producer,
long startTimeNs,
long ledgerId,
long entryId,
Topic.PublishContext publishContext)
Intercept after a message is produced.
|
void |
onConnectionClosed(ServerCnx cnx)
Called by the broker while connection closed.
|
void |
onConnectionCreated(ServerCnx cnx)
Called by the broker when a new connection is created.
|
void |
onPulsarCommand(org.apache.pulsar.common.api.proto.BaseCommand command,
ServerCnx cnx)
Called by the broker while new command incoming.
|
void |
onWebserviceRequest(javax.servlet.ServletRequest request)
Called by the web service while new request incoming.
|
void |
onWebserviceResponse(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
Intercept the webservice response before send to client.
|
void |
producerCreated(ServerCnx cnx,
Producer producer,
Map<String,String> metadata)
Called by the broker when a new connection is created.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonFilterpublic BrokerInterceptors(Map<String,BrokerInterceptorWithClassLoader> interceptors)
public static BrokerInterceptor load(ServiceConfiguration conf) throws IOException
conf - the pulsar broker service configurationIOExceptionpublic void beforeSendMessage(Subscription subscription, Entry entry, long[] ackSet, org.apache.pulsar.common.api.proto.MessageMetadata msgMetadata)
BrokerInterceptorbeforeSendMessage in interface BrokerInterceptorsubscription - 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.public void consumerCreated(ServerCnx cnx, Consumer consumer, Map<String,String> metadata)
BrokerInterceptorconsumerCreated in interface BrokerInterceptorcnx - client Connectionconsumer - Consumer objectmetadata - A map of metdatapublic void producerCreated(ServerCnx cnx, Producer producer, Map<String,String> metadata)
BrokerInterceptorproducerCreated in interface BrokerInterceptorpublic void messageProduced(ServerCnx cnx, Producer producer, long startTimeNs, long ledgerId, long entryId, Topic.PublishContext publishContext)
BrokerInterceptormessageProduced in interface BrokerInterceptorcnx - client Connectionproducer - Producer objectpublishContext - Publish Contextpublic void messageDispatched(ServerCnx cnx, Consumer consumer, long ledgerId, long entryId, io.netty.buffer.ByteBuf headersAndPayload)
BrokerInterceptormessageDispatched in interface BrokerInterceptorcnx - client Connectionconsumer - Consumer objectledgerId - Ledger IDentryId - Entry IDheadersAndPayload - Datapublic void messageAcked(ServerCnx cnx, Consumer consumer, org.apache.pulsar.common.api.proto.CommandAck ackCmd)
BrokerInterceptormessageAcked in interface BrokerInterceptorcnx - client ConnectionackCmd - Command objectpublic void onConnectionCreated(ServerCnx cnx)
BrokerInterceptoronConnectionCreated in interface BrokerInterceptorpublic void onPulsarCommand(org.apache.pulsar.common.api.proto.BaseCommand command,
ServerCnx cnx)
throws org.apache.pulsar.common.intercept.InterceptException
BrokerInterceptoronPulsarCommand in interface BrokerInterceptororg.apache.pulsar.common.intercept.InterceptExceptionpublic void onConnectionClosed(ServerCnx cnx)
BrokerInterceptoronConnectionClosed in interface BrokerInterceptorpublic void onWebserviceRequest(javax.servlet.ServletRequest request)
throws IOException,
javax.servlet.ServletException,
org.apache.pulsar.common.intercept.InterceptException
BrokerInterceptoronWebserviceRequest in interface BrokerInterceptorIOExceptionjavax.servlet.ServletExceptionorg.apache.pulsar.common.intercept.InterceptExceptionpublic void onWebserviceResponse(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response)
throws IOException,
javax.servlet.ServletException
BrokerInterceptoronWebserviceResponse in interface BrokerInterceptorIOExceptionjavax.servlet.ServletExceptionpublic void initialize(PulsarService pulsarService) throws Exception
BrokerInterceptorinitialize in interface BrokerInterceptorException - when fail to initialize the broker interceptor.public void close()
BrokerInterceptorclose in interface AutoCloseableclose in interface BrokerInterceptorCopyright © 2017–2022 Apache Software Foundation. All rights reserved.