dajac commented on code in PR #19515: URL: https://github.com/apache/kafka/pull/19515#discussion_r2085294443
########## clients/src/main/java/org/apache/kafka/common/requests/OffsetFetchRequest.java: ########## @@ -52,13 +54,37 @@ public static class Builder extends AbstractRequest.Builder<OffsetFetchRequest> private final OffsetFetchRequestData data; private final boolean throwOnFetchStableOffsetsUnsupported; - public Builder(OffsetFetchRequestData data, boolean throwOnFetchStableOffsetsUnsupported) { - super(ApiKeys.OFFSET_FETCH); + public static Builder forTopicIdsOrNames(OffsetFetchRequestData data, boolean throwOnFetchStableOffsetsUnsupported, boolean enableUnstableLastVersion) { + return new Builder( + data, + throwOnFetchStableOffsetsUnsupported, + ApiKeys.OFFSET_FETCH.oldestVersion(), + ApiKeys.OFFSET_FETCH.latestVersion(enableUnstableLastVersion) + ); + } + + public static Builder forTopicNames(OffsetFetchRequestData data, boolean throwOnFetchStableOffsetsUnsupported) { + return new Builder( + data, + throwOnFetchStableOffsetsUnsupported, + ApiKeys.OFFSET_FETCH.oldestVersion(), + (short) (TOPIC_ID_MIN_VERSION - 1) + ); + } + + private Builder( + OffsetFetchRequestData data, + boolean throwOnFetchStableOffsetsUnsupported, + short oldestAllowedVersion, + short latestAllowedVersion + ) { + super(ApiKeys.OFFSET_FETCH, oldestAllowedVersion, latestAllowedVersion); this.data = data; this.throwOnFetchStableOffsetsUnsupported = throwOnFetchStableOffsetsUnsupported; } @Override + @SuppressWarnings("checkstyle:cyclomaticComplexity") Review Comment: good idea! -- 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