markobean commented on code in PR #6506:
URL: https://github.com/apache/nifi/pull/6506#discussion_r1014409957


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ControlRate.java:
##########
@@ -71,30 +70,57 @@ public class ControlRate extends AbstractProcessor {
     public static final String DATA_RATE = "data rate";
     public static final String FLOWFILE_RATE = "flowfile count";
     public static final String ATTRIBUTE_RATE = "attribute value";
+    public static final String DATA_OR_FLOWFILE_RATE = "data rate or flowfile 
count";
+
     public static final AllowableValue DATA_RATE_VALUE = new 
AllowableValue(DATA_RATE, DATA_RATE,
             "Rate is controlled by counting bytes transferred per time 
duration.");
     public static final AllowableValue FLOWFILE_RATE_VALUE = new 
AllowableValue(FLOWFILE_RATE, FLOWFILE_RATE,
-            "Rate is controlled by counting flowfiles transferred per time 
duration");
+            "Rate is controlled by counting FlowFiles transferred per time 
duration");
     public static final AllowableValue ATTRIBUTE_RATE_VALUE = new 
AllowableValue(ATTRIBUTE_RATE, ATTRIBUTE_RATE,
             "Rate is controlled by accumulating the value of a specified 
attribute that is transferred per time duration");
+    public static final AllowableValue DATA_OR_FLOWFILE_RATE_VALUE = new 
AllowableValue(DATA_OR_FLOWFILE_RATE, DATA_OR_FLOWFILE_RATE,
+            "Rate is controlled by counting bytes and FlowFiles transferred 
per time duration; if either threshold is met, throttling is enforced");
 
     // based on testing to balance commits and 10,000 FF swap limit
     public static final int MAX_FLOW_FILES_PER_BATCH = 1000;
 
     public static final PropertyDescriptor RATE_CONTROL_CRITERIA = new 
PropertyDescriptor.Builder()
             .name("Rate Control Criteria")
+            .displayName("Rate Control Criteria")
             .description("Indicates the criteria that is used to control the 
throughput rate. Changing this value resets the rate counters.")
             .required(true)
-            .allowableValues(DATA_RATE_VALUE, FLOWFILE_RATE_VALUE, 
ATTRIBUTE_RATE_VALUE)
+            .allowableValues(DATA_RATE_VALUE, FLOWFILE_RATE_VALUE, 
ATTRIBUTE_RATE_VALUE, DATA_OR_FLOWFILE_RATE_VALUE)
             .defaultValue(DATA_RATE)
             .build();
     public static final PropertyDescriptor MAX_RATE = new 
PropertyDescriptor.Builder()
             .name("Maximum Rate")
+            .displayName("Maximum Rate")
             .description("The maximum rate at which data should pass through 
this processor. The format of this property is expected to be a "
                     + "positive integer, or a Data Size (such as '1 MB') if 
Rate Control Criteria is set to 'data rate'.")
-            .required(true)
+            .required(false)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) // validated 
in customValidate b/c dependent on Rate Control Criteria
+            .dependsOn(RATE_CONTROL_CRITERIA, DATA_RATE_VALUE, 
FLOWFILE_RATE_VALUE, ATTRIBUTE_RATE_VALUE)
+            .build();
+    public static final PropertyDescriptor MAX_DATA_RATE = new 
PropertyDescriptor.Builder()
+            .name("Maximum Data Rate")
+            .displayName("Maximum Data Rate")
+            .description("The maximum rate at which data should pass through 
this processor. The format of this property is expected to be a "
+                    + "Data Size (such as '1 MB') representing bytes per Time 
Duration.")
+            .required(false)
+            .addValidator(StandardValidators.DATA_SIZE_VALIDATOR)
+            .dependsOn(RATE_CONTROL_CRITERIA, DATA_OR_FLOWFILE_RATE)
             .build();
+
+    public static final PropertyDescriptor MAX_COUNT_RATE = new 
PropertyDescriptor.Builder()
+            .name("Maximum FlowFile Rate")
+            .displayName("Maximum FlowFile Rate")
+            .description("The maximum rate at which FlowFiles should pass 
through this processor. The format of this property is expected to be a "
+                    + "positive integer representing FlowFiles count per Time 
Duration")
+            .required(false)
+            .addValidator(StandardValidators.POSITIVE_LONG_VALIDATOR)
+            .dependsOn(RATE_CONTROL_CRITERIA, DATA_OR_FLOWFILE_RATE)
+            .build();
+
     public static final PropertyDescriptor RATE_CONTROL_ATTRIBUTE_NAME = new 
PropertyDescriptor.Builder()
             .name("Rate Controlled Attribute")
             .description("The name of an attribute whose values build toward 
the rate limit if Rate Control Criteria is set to 'attribute value'. "

Review Comment:
   Good call. The `dependsOn` wasn't an option when this property was first 
created. It makes sense to add it now (even though not explicitly part of this 
ticket.)



-- 
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: [email protected]

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

Reply via email to