lhotari commented on code in PR #24071:
URL: https://github.com/apache/pulsar/pull/24071#discussion_r1993217301


##########
pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java:
##########
@@ -1171,6 +1176,21 @@ public void testDeadLetterTopicWithProducerBuilder() 
throws Exception {
             consumer.reconsumeLater(message, 1, TimeUnit.SECONDS);
         } while (totalReceived < sendMessages * (maxRedeliveryCount + 1));
 
+        // check the retry topic producer enable batch
+        List<ConsumerImpl<byte[]>> consumers = 
((MultiTopicsConsumerImpl<byte[]>) consumer).getConsumers();
+        for (ConsumerImpl<byte[]> consumerImpl : consumers) {
+            CompletableFuture<Producer<byte[]>> retryProducer = 
consumerImpl.getRetryLetterProducer();
+            CompletableFuture<Producer<byte[]>> deadLetterProducer = 
consumerImpl.getDeadLetterProducer();
+            if (retryProducer != null) {

Review Comment:
   shouldn't it be expended that retryProducer and deadLetterProducer isn't 
null?
   btw. you could simplify the assertions by using AssertJ. One of the benefits 
is that it has ways to provide better error messages when things fail and the 
API is nice.
   
   The complete check would be like this in AssertJ:
   ```java
   import static org.assertj.core.api.Assertions.assertThat;
   ...
   
           assertThat(((MultiTopicsConsumerImpl<byte[]>) 
consumer).getConsumers()).isNotEmpty()
                   .allSatisfy(consumerImpl -> {
                       
assertThat(consumerImpl.getRetryLetterProducer()).isCompletedWithValueMatching(p
 ->
                               ((ProducerImpl) p).isBatchMessagingEnabled()
                       );
                       
assertThat(consumerImpl.getDeadLetterProducer()).isCompletedWithValueMatching(p 
->
                               ((ProducerImpl) p).isBatchMessagingEnabled()
                       );
                   });
   ```
   
   



-- 
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-unsubscr...@pulsar.apache.org

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

Reply via email to