mumrah opened a new pull request #10696:
URL: https://github.com/apache/kafka/pull/10696


   Rather than using multiple optional class members to determine if we are in 
ZK or KRaft mode, use inheritance. The factory method in 
AutoTopicCreationManager now makes the decision about which mode we're in and 
provides only the needed dependencies to the concrete classes (no optionals).
   
   ```scala
   object AutoTopicCreationManager {
     def apply(
       config: KafkaConfig,
       channelManager: BrokerToControllerChannelManager,
       metadataSupport: MetadataSupport,
       groupCoordinator: GroupCoordinator,
       txnCoordinator: TransactionCoordinator,
     ): AutoTopicCreationManager = {
       metadataSupport match {
         case zk: ZkSupport => new ZkAutoTopicCreationManager(config, zk, 
groupCoordinator, txnCoordinator)
         case _: RaftSupport => new DefaultAutoTopicCreationManager(config, 
channelManager, groupCoordinator, txnCoordinator)
       }
     }
   }
   ```
   
   This also adds some error handling to the response handler when running in 
KRaft mode (KAFKA-12777).


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

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


Reply via email to