You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/25 17:00:49 UTC

[GitHub] [pulsar] michaeljmarshall commented on a change in pull request #14870: [fix][java-client] Fix message publishing stuck when enabling batch

michaeljmarshall commented on a change in pull request #14870:
URL: https://github.com/apache/pulsar/pull/14870#discussion_r835447418



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
##########
@@ -1802,6 +1802,10 @@ private void resendMessages(ClientCnx cnx, long expectedEpoch) {
                     cnx.channel().close();
                     return;
                 }
+
+                if (isBatchMessagingEnabled()) {
+                    batchMessageAndSend(false);
+                }

Review comment:
       What do you think about instead calling `scheduleBatchFlushTask(0)` in the below code block? For example:
   
   ```java
                       if (changeToReadyState()) {
                           producerCreatedFuture.complete(ProducerImpl.this);
                           scheduleBatchFlushTask(0);
                           return;
                       } else {
   ```
   
   The advantage of this solution is that users with a longer `BatchingMaxPublishDelayMicros` won't end up with under-filled batches because the underlying logic of `scheduleBatchFlushTask` verifies that the batch hasn't been flushed too recently. This might happen in scenarios where the client briefly gets disconnected from the broker.




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org