Rancho-7 commented on code in PR #20301: URL: https://github.com/apache/kafka/pull/20301#discussion_r2296522047
########## tools/src/main/java/org/apache/kafka/tools/EndToEndLatency.java: ########## @@ -77,21 +87,35 @@ static int mainNoExit(String... args) { } // Visible for testing - static void execute(String... args) throws Exception { - if (args.length != 5 && args.length != 6) { - throw new TerseException("USAGE: java " + EndToEndLatency.class.getName() - + " broker_list topic num_messages producer_acks message_size_bytes [optional] properties_file"); - } + static void execute(String[] args) throws Exception { + String[] processedArgs = convertLegacyArgsIfNeeded(args); + EndToEndLatencyCommandOptions opts = new EndToEndLatencyCommandOptions(processedArgs); - String brokers = args[0]; - String topic = args[1]; - int numMessages = Integer.parseInt(args[2]); - String acks = args[3]; - int messageSizeBytes = Integer.parseInt(args[4]); - Optional<String> propertiesFile = (args.length > 5 && !Utils.isBlank(args[5])) ? Optional.of(args[5]) : Optional.empty(); + // required + String brokers = opts.options.valueOf(opts.bootstrapServerOpt); + String topic = opts.options.valueOf(opts.topicOpt); + int numRecords = opts.options.valueOf(opts.numRecordsOpt); + String acks = opts.options.valueOf(opts.acksOpt); + int recordValueSize = opts.options.valueOf(opts.recordSizeOpt); - if (!List.of("1", "all").contains(acks)) { - throw new IllegalArgumentException("Latency testing requires synchronous acknowledgement. Please use 1 or all"); + // optional + Optional<String> propertiesFile = opts.options.has(opts.commandConfigOpt) ? + Optional.of(opts.options.valueOf(opts.commandConfigOpt)) : Optional.empty(); + int recordKeySize = 0; Review Comment: You're right, using a default value would be much cleaner. Updated it. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org