MikeThomsen commented on a change in pull request #3885:
URL: https://github.com/apache/nifi/pull/3885#discussion_r500955709



##########
File path: 
nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-1-0-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/ConsumeKafkaRecord_1_0.java
##########
@@ -332,6 +336,24 @@ protected ConsumerPool createConsumerPool(final 
ProcessContext context, final Co
         }
     }
 
+    public static Validator createListLengthValidator(int length) {
+        return (subject, input, context) -> {
+            if (context.isExpressionLanguageSupported(subject) && 
context.isExpressionLanguagePresent(input)) {
+                return new 
ValidationResult.Builder().subject(subject).input(input).explanation("Expression
 Language Present").valid(true).build();
+            }
+            if (input == null || input.trim().isEmpty()) {

Review comment:
       `StringUtils.isEmpty` is better here.

##########
File path: 
nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-1-0-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/ConsumeKafkaRecord_1_0.java
##########
@@ -86,12 +87,15 @@
     static final AllowableValue TOPIC_NAME = new AllowableValue("names", 
"names", "Topic is a full topic name or comma separated list of names");
     static final AllowableValue TOPIC_PATTERN = new AllowableValue("pattern", 
"pattern", "Topic is a regex using the Java Pattern syntax");
 
+    static final int TOPIC_LIST_MAX_LENGTH = 1000;

Review comment:
       I agree with @joewitt that we cannot go up 10x without a serious 
performance evaluation.

##########
File path: 
nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-1-0-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/ConsumeKafkaRecord_1_0.java
##########
@@ -332,6 +336,24 @@ protected ConsumerPool createConsumerPool(final 
ProcessContext context, final Co
         }
     }
 
+    public static Validator createListLengthValidator(int length) {
+        return (subject, input, context) -> {
+            if (context.isExpressionLanguageSupported(subject) && 
context.isExpressionLanguagePresent(input)) {
+                return new 
ValidationResult.Builder().subject(subject).input(input).explanation("Expression
 Language Present").valid(true).build();
+            }
+            if (input == null || input.trim().isEmpty()) {
+                return new 
ValidationResult.Builder().subject(subject).input(input).explanation("List must 
have at least one non-empty element").valid(false).build();
+            }
+            final int listLength = input.split(",").length;

Review comment:
       Better expression is `input.chars().filter(c -> c == ',').count()`




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to