AndrewJSchofield commented on code in PR #22242:
URL: https://github.com/apache/kafka/pull/22242#discussion_r3209934883


##########
clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/PlaintextConsumerCallbackTest.java:
##########
@@ -218,7 +219,8 @@ private void 
testOnPartitionsAssignedCalledWithExpectedPartitions(
     private void subscribeAndExpectOnPartitionsAssigned(Consumer<byte[], 
byte[]> consumer, List<String> topics, Collection<TopicPartition> 
expectedPartitionsInCallback) throws InterruptedException {
         var partitionsAssigned = new AtomicBoolean(false);
         AtomicReference<Collection<TopicPartition>> partitionsFromCallback = 
new AtomicReference<>();
-        consumer.subscribe(topics, new ConsumerRebalanceListener() {
+        consumer.subscribe(topics);
+        consumer.setConsumerRebalanceListener(new ConsumerRebalanceListener() {

Review Comment:
   I'd set the rebalance listener before subscribing. Otherwise, you have a 
tiny race condition.



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