poorbarcode commented on code in PR #21048:
URL: https://github.com/apache/pulsar/pull/21048#discussion_r1309965178
##########
pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java:
##########
@@ -154,28 +170,42 @@ public void testDeadLetterTopic() throws Exception {
Producer<byte[]> producer = pulsarClient.newProducer(Schema.BYTES)
.topic(topic)
+ .enableChunking(produceLargeMessages)
+ .enableBatching(!produceLargeMessages)
.create();
+ Map<Integer, String> messageContent = new HashMap<>();
+
for (int i = 0; i < sendMessages; i++) {
- producer.send(String.format("Hello Pulsar [%d]", i).getBytes());
+ String data;
+ if (!produceLargeMessages) {
+ data = String.format("Hello Pulsar [%d]", i);
+ } else {
+ data = createMessagePayload(1024 * 10);
+ }
+
producer.newMessage().key(String.valueOf(i)).value(data.getBytes()).send();
+ messageContent.put(i, data);
}
producer.close();
int totalReceived = 0;
do {
Message<byte[]> message = consumer.receive();
- log.info("consumer received message : {} {}",
message.getMessageId(), new String(message.getData()));
+ log.info("consumer received message : {}", message.getMessageId());
totalReceived++;
} while (totalReceived < sendMessages * (maxRedeliveryCount + 1));
int totalInDeadLetter = 0;
do {
Message message = deadLetterConsumer.receive();
Review Comment:
This method does not add a timeout, some unexpected things will cause the CI
not to finish.
Could we change `deadLetterConsumer.receive()` to
`deadLetterConsumer.receive(timeout)`, or create a new thread to receive
messages?
--
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]