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/06/20 10:52:18 UTC

[GitHub] [pulsar] gaoran10 commented on a diff in pull request #16142: [fix][txn] Fix NPE when ack message with transaction at cnx = null

gaoran10 commented on code in PR #16142:
URL: https://github.com/apache/pulsar/pull/16142#discussion_r901528330


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:
##########
@@ -2679,7 +2679,14 @@ private CompletableFuture<Void> doTransactionAcknowledgeForResponse(MessageId me
         } else {
             unAckedMessageTracker.remove(messageId);
         }
-        return cnx().newAckForReceipt(cmd, requestId);
+        ClientCnx cnx = cnx();
+        if (cnx == null) {
+            return FutureUtil.failedFuture(new PulsarClientException
+                    .ConnectException("Failed to ack message [" + messageId + "] "
+                    + "for transaction [" + txnID + "] due to cnx = null"));

Review Comment:
   ```suggestion
                       + "for transaction [" + txnID + "] due to consumer connect fail, consumer state: " + getState()));
   ```



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