jigar-bhati commented on code in PR #267:
URL: 
https://github.com/apache/flink-connector-kafka/pull/267#discussion_r3761952472


##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/KafkaPropertiesUtil.java:
##########
@@ -36,6 +39,41 @@ public static void copyProperties(@Nonnull Properties from, 
@Nonnull Properties
         }
     }
 
+    /** Resolves an explicit cluster or global reset strategy before the 
initializer default. */
+    public static String resolveAutoOffsetResetStrategy(
+            @Nonnull Properties globalProperties,
+            @Nonnull Properties clusterProperties,
+            @Nonnull OffsetsInitializer startingOffsetsInitializer) {
+        String clusterReset =
+                
clusterProperties.getProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG);
+        if (clusterReset != null) {
+            return clusterReset;
+        }
+
+        String globalReset = 
globalProperties.getProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG);
+        if (globalReset != null) {
+            return globalReset;
+        }
+
+        return 
startingOffsetsInitializer.getAutoOffsetResetStrategy().name().toLowerCase();
+    }
+
+    /** Returns whether the configured strategy opposes a positional 
initializer strategy. */
+    public static boolean hasOpposingOffsetResetStrategies(
+            @Nonnull String configuredResetStrategy,

Review Comment:
   Done. `hasOpposingOffsetResetStrategies` now accepts `OffsetResetStrategy`, 
and the positional check uses `OffsetResetStrategy.EARLIEST` / 
`OffsetResetStrategy.LATEST` directly.



##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/KafkaSourceBuilder.java:
##########
@@ -468,10 +468,25 @@ private void parseAndSetRequiredProperties() {
             
maybeOverride(KafkaSourceOptions.COMMIT_OFFSETS_ON_CHECKPOINT.key(), "false", 
false);
         }
         maybeOverride(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "false", 
false);
+        String configuredOffsetResetStrategy =

Review Comment:
   Done. I added shared `KafkaPropertiesUtil.getResetStrategy(...)`; the static 
and dynamic paths now parse configured properties through it and use the enum 
internally.



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