AndrewJSchofield commented on code in PR #20361:
URL: https://github.com/apache/kafka/pull/20361#discussion_r2293555648


##########
tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java:
##########
@@ -540,43 +578,68 @@ static final class ConfigPostProcessor {
         final Long transactionDurationMs;
         final boolean transactionsEnabled;
         final List<byte[]> payloadByteList;
+        final long reportingInterval;
 
         public ConfigPostProcessor(ArgumentParser parser, String[] args) 
throws IOException, ArgumentParserException {
             Namespace namespace = parser.parseArgs(args);
+            this.bootstrapServers = namespace.getString("bootstrapServers");
             this.topicName = namespace.getString("topic");
             this.numRecords = namespace.getLong("numRecords");
             this.warmupRecords = Math.max(namespace.getLong("warmupRecords"), 
0);
             this.recordSize = namespace.getInt("recordSize");
             this.throughput = namespace.getDouble("throughput");
             this.payloadMonotonic = namespace.getBoolean("payloadMonotonic");
             this.shouldPrintMetrics = namespace.getBoolean("printMetrics");
+            this.reportingInterval = namespace.getLong("reportingInterval");
 
             List<String> producerConfigs = namespace.getList("producerConfig");
             String producerConfigFile = 
namespace.getString("producerConfigFile");
+            List<String> commandProperties = 
namespace.getList("commandProperties");
+            String commandConfigFile = 
namespace.getString("commandConfigFile");
             String payloadFilePath = namespace.getString("payloadFile");
             Long transactionDurationMsArg = 
namespace.getLong("transactionDurationMs");
             String transactionIdArg = namespace.getString("transactionalId");
             if (numRecords <= 0) {
-                throw new ArgumentParserException("--num-records should be 
greater than zero", parser);
+                throw new ArgumentParserException("--num-records should be 
greater than zero.", parser);
             }
             if (warmupRecords >= numRecords) {
                 throw new ArgumentParserException("The value for 
--warmup-records must be strictly fewer than the number of records in the test, 
--num-records.", parser);
             }
             if (recordSize != null && recordSize <= 0) {
-                throw new ArgumentParserException("--record-size should be 
greater than zero", parser);
+                throw new ArgumentParserException("--record-size should be 
greater than zero.", parser);
+            }
+            if (bootstrapServers == null && commandProperties == null && 
producerConfigs == null && producerConfigFile == null && commandConfigFile == 
null) {
+                throw new ArgumentParserException("At least one of 
--bootstrap-server, --command-property, --producer-props, --producer.config or 
--command-config must be specified.", parser);
+            }
+            if (commandProperties != null && producerConfigs != null) {
+                throw new ArgumentParserException("--command-property and 
--producer-props cannot be specified together.", parser);
             }
-            if (producerConfigs == null && producerConfigFile == null) {
-                throw new ArgumentParserException("Either --producer-props or 
--producer.config must be specified.", parser);
+            if (commandConfigFile != null && producerConfigFile != null) {

Review Comment:
   Yup, I'll add a test.



-- 
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

Reply via email to