aloyszhang commented on code in PR #17269:
URL: https://github.com/apache/pulsar/pull/17269#discussion_r966567468
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Producer.java:
##########
@@ -246,18 +246,26 @@ public boolean checkAndStartPublish(long producerId, long
sequenceId, ByteBuf he
private void publishMessageToTopic(ByteBuf headersAndPayload, long
sequenceId, long batchSize, boolean isChunked,
boolean isMarker) {
- topic.publishMessage(headersAndPayload,
- MessagePublishContext.get(this, sequenceId, msgIn,
- headersAndPayload.readableBytes(), batchSize,
- isChunked, System.nanoTime(), isMarker));
+ MessagePublishContext messagePublishContext =
+ MessagePublishContext.get(this, sequenceId, msgIn,
headersAndPayload.readableBytes(),
+ batchSize, isChunked, System.nanoTime(), isMarker);
+ if (this.cnx.getBrokerService().getInterceptor() != null){
+ this.cnx.getBrokerService().getInterceptor()
+ .onMessagePublish(this, headersAndPayload,
messagePublishContext);
+ }
+ topic.publishMessage(headersAndPayload, messagePublishContext);
}
private void publishMessageToTopic(ByteBuf headersAndPayload, long
lowestSequenceId, long highestSequenceId,
long batchSize, boolean isChunked,
boolean isMarker) {
- topic.publishMessage(headersAndPayload,
- MessagePublishContext.get(this, lowestSequenceId,
- highestSequenceId, msgIn,
headersAndPayload.readableBytes(), batchSize,
- isChunked, System.nanoTime(), isMarker));
+ MessagePublishContext messagePublishContext =
MessagePublishContext.get(this, lowestSequenceId,
+ highestSequenceId, msgIn, headersAndPayload.readableBytes(),
batchSize,
+ isChunked, System.nanoTime(), isMarker);
+ if (this.cnx.getBrokerService().getInterceptor() != null){
Review Comment:
`BrokerInterceptorDisabled` is already implemented. Initialize the
interceptor as a `BrokerInterceptorDisabled` if no interceptors are configured.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]