BewareMyPower commented on code in PR #25036:
URL: https://github.com/apache/pulsar/pull/25036#discussion_r2587197081


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/TransactionTest.java:
##########
@@ -330,6 +331,21 @@ public void testCreateTransactionSystemTopic() throws 
Exception {
             assertEquals(e.getMessage(), "Cannot create topic in system topic 
format!");
         }
     }
+    @Test(timeOut = 10000)
+    public void testAckTnxWithNullMessageId() throws Exception {
+        final String topic = 
BrokerTestUtil.newUniqueName("persistent://tnx/ns1/testAckTnxWithNullMessageId");
+        @Cleanup final Consumer<String> consumer = 
pulsarClient.newConsumer(Schema.STRING)
+                .topic(topic)
+                .subscriptionName("sub1")
+                .subscribe();
+        List<MessageId> messageIdList = null;
+        assertThatThrownBy(
+                () -> consumer.acknowledgeAsync(messageIdList, null).get()

Review Comment:
   and I think a null transaction is accepted, though it's not formally 
documented. In this case, it will fall back to `acknowledgeAsync(messageIdList)`



##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/TransactionTest.java:
##########
@@ -330,6 +331,21 @@ public void testCreateTransactionSystemTopic() throws 
Exception {
             assertEquals(e.getMessage(), "Cannot create topic in system topic 
format!");
         }
     }
+    @Test(timeOut = 10000)
+    public void testAckTnxWithNullMessageId() throws Exception {
+        final String topic = 
BrokerTestUtil.newUniqueName("persistent://tnx/ns1/testAckTnxWithNullMessageId");
+        @Cleanup final Consumer<String> consumer = 
pulsarClient.newConsumer(Schema.STRING)
+                .topic(topic)
+                .subscriptionName("sub1")
+                .subscribe();
+        List<MessageId> messageIdList = null;
+        assertThatThrownBy(
+                () -> consumer.acknowledgeAsync(messageIdList, null).get()

Review Comment:
   and I think a null transaction should be accepted, though it's not formally 
documented. In this case, it will fall back to `acknowledgeAsync(messageIdList)`



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