private static void validateAutoOffsetResetValue ( Properties config ) { final String val = config . getProperty ( ConsumerConfig . AUTO_OFFSET_RESET_CONFIG , "largest" ) ; if ( ! ( val . equals ( "largest" ) || val . equals ( "latest" ) || val . equals ( "earliest" ) || val . equals ( "smallest" ) ) ) { // largest/smallest is kafka 0.8, latest/earliest is kafka 0.9 throw new IllegalArgumentException ( "Cannot use '" + ConsumerConfig . AUTO_OFFSET_RESET_CONFIG + "' value '" + val + "'. Possible values: 'latest', 'largest', 'earliest', or 'smallest'." ) ; } }
Check for invalid auto . offset . reset values . Should be called in constructor for eager checking before submitting the job . Note that none is also considered invalid as we don t want to deliberately throw an exception right after a task is started .