merlimat commented on a change in pull request #2471: Pulsar Java Client 
Interceptors.
URL: https://github.com/apache/incubator-pulsar/pull/2471#discussion_r213785491
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
 ##########
 @@ -204,10 +205,12 @@ public long getLastSequenceId() {
     }
 
     @Override
-    CompletableFuture<MessageId> internalSendAsync(Message<T> message) {
-        CompletableFuture<MessageId> future = new CompletableFuture<>();
+    CompletableFuture<MessageId> internalSendAsync(Message<T> message) 
{CompletableFuture<MessageId> future = new CompletableFuture<>();
 
-        sendAsync(message, new SendCallback() {
+        MessageImpl<T> interceptorMessage = (MessageImpl<T>) 
beforeSend(message);
+        interceptorMessage.getDataBuffer().retain();
 
 Review comment:
   Can you add a comment on why we are retaining the buffer here and when it 
will be released? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to