ConsoleConsumer: deprecate --new-consumer option
Marked --new-consumer as deprecated in the help of ConsoleConsumer
and a warning will be printed if it's used.
Author: Paolo Patierno
Reviewers: Ismael Juma
Closes from ppatierno/kafka-5599
@@ -269,7 +269,8 @@ object ConsoleConsumer extends Logging {
.withRequiredArg
.describedAs("metrics directory")
.ofType(classOf[java.lang.String])
- val newConsumerOpt = parser.accepts("new-consumer", "Use the new consumer implementation. This is the default.")
+ val newConsumerOpt = parser.accepts("new-consumer", "Use the new consumer implementation. This is the default, so " +
+ "this option is deprecated and will be removed in a future release.")
val bootstrapServerOpt = parser.accepts("bootstrap-server", "REQUIRED (unless old consumer is used): The server to connect to.")
.withRequiredArg
.describedAs("server to connect to")
@@ -386,9 +387,15 @@ object ConsoleConsumer extends Logging {
else if (fromBeginning) OffsetRequest.EarliestTime
else OffsetRequest.LatestTime
- if (!useOldConsumer)
+ if (!useOldConsumer) {
CommandLineUtils.checkRequiredArgs(parser, options, bootstrapServerOpt)
+ if (options.has(newConsumerOpt)) {
+ Console.err.println("The --new-consumer option is deprecated and will be removed in a future major release." +
+ "The new consumer is used by default if the --bootstrap-server option is provided.")
+ }
+ }
+
if (options.has(csvMetricsReporterEnabledOpt)) {
val csvReporterProps = new Properties()
csvReporterProps.put("kafka.metrics.polling.interval.secs", "5")
