codelipenghui commented on code in PR #22372:
URL: https://github.com/apache/pulsar/pull/22372#discussion_r1554810661
##########
pulsar-broker/src/test/java/org/apache/pulsar/client/api/ConsumerRedeliveryTest.java:
##########
@@ -424,4 +424,24 @@ public void testAckNotSent(int numAcked, int batchSize,
CommandAck.AckType ackTy
assertTrue(values.isEmpty());
}
}
+
+ @Test
+ public void testRedeliverMessagesWithoutValue() throws Exception {
+ String topic =
"persistent://my-property/my-ns/testRedeliverMessagesWithoutValue";
+ @Cleanup Consumer<Integer> consumer =
pulsarClient.newConsumer(Schema.INT32)
+ .topic(topic)
+ .subscriptionName("sub")
+ .enableRetry(true)
+ .subscribe();
+ @Cleanup Producer<Integer> producer =
pulsarClient.newProducer(Schema.INT32)
+ .topic(topic)
+ .enableBatching(true)
+ .create();
+ for (int i = 0; i < 10; i++) {
+ producer.newMessage().key("messages without value").send();
+ }
+
+ Message<Integer> message = consumer.receive();
+ consumer.reconsumeLater(message, 2, TimeUnit.SECONDS);
Review Comment:
It's better to add an `assert` to ensure the message could be redelivered
later.
##########
pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactionTest.java:
##########
@@ -1384,7 +1384,7 @@ public void testEmptyPayloadDeletesWhenEncrypted() throws
Exception {
Message<byte[]> message4 = consumer.receive();
Assert.assertEquals(message4.getKey(), "key2");
- Assert.assertEquals(new String(message4.getData()), "");
Review Comment:
I don't think this is a break change. It's a BUG fix.
Users send a message without a value should be treated as null value, not
empty "String".
--
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]