jigar-bhati commented on code in PR #267:
URL:
https://github.com/apache/flink-connector-kafka/pull/267#discussion_r3769089135
##########
flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/KafkaPropertiesUtil.java:
##########
@@ -40,38 +44,56 @@ 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(
+ public static OffsetResetStrategy 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 getResetStrategy(
+ clusterProperties.getProperty(
+ ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,
+ globalProperties.getProperty(
+ ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,
+ startingOffsetsInitializer
+ .getAutoOffsetResetStrategy()
+ .name())));
+ }
- return
startingOffsetsInitializer.getAutoOffsetResetStrategy().name().toLowerCase();
+ /** Parses the configured auto offset reset strategy. */
+ public static OffsetResetStrategy getResetStrategy(@Nonnull String
offsetResetConfig) {
Review Comment:
Makes sense, done!
--
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]