omkreddy commented on code in PR #17972:
URL: https://github.com/apache/kafka/pull/17972#discussion_r1863012807
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AutoOffsetResetStrategy.java:
##########
@@ -39,29 +43,67 @@ public String toString() {
public static final AutoOffsetResetStrategy NONE = new
AutoOffsetResetStrategy(StrategyType.NONE);
private final StrategyType type;
+ private final Optional<Duration> duration;
private AutoOffsetResetStrategy(StrategyType type) {
+ this(type, Optional.empty());
+ }
+
+ private AutoOffsetResetStrategy(StrategyType type, Optional<Duration>
duration) {
this.type = type;
+ this.duration = duration;
}
+ /**
+ * Returns true if the given string is a valid auto offset reset strategy.
+ */
public static boolean isValid(String offsetStrategy) {
- return
Arrays.asList(Utils.enumOptions(StrategyType.class)).contains(offsetStrategy);
+ if (offsetStrategy == null) {
+ return false;
+ } else if (StrategyType.BY_DURATION.toString().equals(offsetStrategy))
{
+ return false;
Review Comment:
Currently we are throwing below error for validation error. I think this
should sufficient user visibility visibility. But let me know if we want to
propagate exact error to logs.
```
"Invalid value `xyz` for configuration auto.offset.reset. The value must be
either 'earliest', 'latest', 'none' or of the format
'by_duration:<PnDTnHnMn.nS.>'.";
```
--
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]