cadonna commented on code in PR #14872: URL: https://github.com/apache/kafka/pull/14872#discussion_r1410526919
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java: ########## @@ -398,6 +387,38 @@ public class AsyncKafkaConsumer<K, V> implements ConsumerDelegate<K, V> { requestManagersSupplier); } + private Optional<ConsumerGroupMetadata> initializeGroupMetadata(final ConsumerConfig config, + final GroupRebalanceConfig groupRebalanceConfig) { + final Optional<ConsumerGroupMetadata> groupMetadata = initializeGroupMetadata( + groupRebalanceConfig.groupId, + groupRebalanceConfig.groupInstanceId + ); + if (!groupMetadata.isPresent()) { + config.ignore(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG); + config.ignore(THROW_ON_FETCH_STABLE_OFFSET_UNSUPPORTED); + } + return groupMetadata; + } + + private Optional<ConsumerGroupMetadata> initializeGroupMetadata(final String groupId, + final Optional<String> groupInstanceId) { + if (groupId != null) { + if (groupId.isEmpty()) { + throwInInvalidGroupIdException(); + return Optional.empty(); Review Comment: Yes, I know, but without it won't compile because it needs a return statement in each branch. However, I think I found a better solution, now. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org