Package org.apache.pulsar.client.api
Interface ReaderInterceptor<T>
- Type Parameters:
T-
Reader interceptor.
-
Method Summary
Modifier and TypeMethodDescriptionbeforeRead(Reader<T> reader, Message<T> message) This is called just before the message is returned byReader.readNext(),ReaderListener.received(Reader, Message)or theCompletableFuturereturned byReader.readNextAsync()completes.voidclose()Close the interceptor.default voidonPartitionsChange(String topicName, int partitions) This method is called when partitions of the topic (partitioned-topic) changes.
-
Method Details
-
close
void close()Close the interceptor. -
beforeRead
This is called just before the message is returned byReader.readNext(),ReaderListener.received(Reader, Message)or theCompletableFuturereturned byReader.readNextAsync()completes. This method is based onConsumerInterceptor.beforeConsume(Consumer, Message), so it has the same features.- Parameters:
reader- the reader which contains the interceptormessage- the message to be read by the client.- Returns:
- message that is either modified by the interceptor or same message passed into the method.
-
onPartitionsChange
This method is called when partitions of the topic (partitioned-topic) changes.- Parameters:
topicName- topic namepartitions- new updated number of partitions
-