lhotari commented on code in PR #25555:
URL: https://github.com/apache/pulsar/pull/25555#discussion_r3117231075


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Producer.java:
##########
@@ -223,14 +229,19 @@ public void publishMessage(long producerId, long 
lowestSequenceId, long highestS
             });
             return;
         }
-        if (checkAndStartPublish(producerId, highestSequenceId, 
headersAndPayload, batchSize, position)) {
-            publishMessageToTopic(headersAndPayload, lowestSequenceId, 
highestSequenceId, batchSize, isChunked,
-                    isMarker, position);
+        MessagePublishContext messagePublishContext = 
MessagePublishContext.get(this, lowestSequenceId,
+                highestSequenceId, headersAndPayload.readableBytes(), 
batchSize,
+                isChunked, System.nanoTime(), isMarker, position, 
isSupportsReplDedupByLidAndEid());
+        if (checkAndStartPublish(producerId, highestSequenceId, 
headersAndPayload, batchSize, position,
+                messagePublishContext)) {
+            publishMessageToTopic(headersAndPayload, messagePublishContext);
+        } else {
+            messagePublishContext.recycle();
         }
     }
 
     public boolean checkAndStartPublish(long producerId, long sequenceId, 
ByteBuf headersAndPayload, int batchSize,
-                                        Position position) {
+                                        Position position, PublishContext 
publishContext) {

Review Comment:
   this changes the signature of a public method. Technically it's a breaking 
change, but could 3rd party plugins override the Producer class and is changing 
the method signatures a concern?
   If it's not a concern, I'd suggest omitting all parameters that are part of 
PublishContext and getting them from the PublishContext instead of passing them 
as parameters to the method. In general, the number of parameters to a method 
should be minimized.
   



-- 
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]

Reply via email to