MINOR: ignore unused configuration when ConsumerCoordinator is not constructed
Following PR ignore unused config when ConsumerCoordinator is not constructed.
Reviewers: Guozhang Wang
@@ -774,8 +774,12 @@ public class KafkaConsumer<K, V> implements Consumer<K, V> {
);
// no coordinator will be constructed for the default (null) group id
- this.coordinator = !groupId.isPresent() ? null :
- new ConsumerCoordinator(groupRebalanceConfig,
+ if (!groupId.isPresent()) {
+ config.ignore(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG);
+ config.ignore(ConsumerConfig.THROW_ON_FETCH_STABLE_OFFSET_UNSUPPORTED);
+ this.coordinator = null;
+ } else {
+ this.coordinator = new ConsumerCoordinator(groupRebalanceConfig,
logContext,
this.client,
assignors,
@@ -788,6 +792,7 @@ public class KafkaConsumer<K, V> implements Consumer<K, V> {
config.getInt(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG),
this.interceptors,
config.getBoolean(ConsumerConfig.THROW_ON_FETCH_STABLE_OFFSET_UNSUPPORTED));
+ }
this.fetcher = new Fetcher<>(
logContext,
this.client,
