chia7712 commented on PR #16876:
URL: https://github.com/apache/kafka/pull/16876#issuecomment-2295339980

   @frankvicky I feel the refactor is a bit overkill. Maybe we can add 
following two methods:
   
   ```java
           public static Builder forConsumer(boolean requireTimestamp,
                                             IsolationLevel isolationLevel) {
               return forConsumer(requireTimestamp, isolationLevel, false, 
false, false);
           }
   
           public static Builder forConsumer(boolean requireTimestamp,
                                             IsolationLevel isolationLevel,
                                             boolean requireMaxTimestamp,
                                             boolean requireEarliestTimestamp,
                                             boolean 
requireTieredStorageTimestamp) {
               short minVersion = 0;
               if (requireTieredStorageTimestamp)
                   minVersion = 9;
               else if (requireEarliestTimestamp)
                   minVersion = 8;
               else if (requireMaxTimestamp)
                   minVersion = 7;
               else if (isolationLevel == IsolationLevel.READ_COMMITTED)
                   minVersion = 2;
               else if (requireTimestamp)
                   minVersion = 1;
               return new Builder(minVersion, 
ApiKeys.LIST_OFFSETS.latestVersion(), CONSUMER_REPLICA_ID, isolationLevel);
           }
   ```
   Those two methods should cover all use cases for 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

Reply via email to