orpiske commented on code in PR #13040: URL: https://github.com/apache/camel/pull/13040#discussion_r1481684275
########## core/camel-core-model/src/main/java/org/apache/camel/model/ThrottleDefinition.java: ########## @@ -89,35 +120,132 @@ public String getShortName() { @Override public String getLabel() { - return "throttle[" + getExpression() + "]"; + return "throttle[" + description() + "]"; } // Fluent API // ------------------------------------------------------------------------- /** - * Sets the maximum number of concurrent requests + * Sets the time period during which the maximum request count is valid for + * + * @param timePeriodMillis period in millis + * @return the builder + */ + public ThrottleDefinition timePeriodMillis(long timePeriodMillis) { + return timePeriodMillis(Long.toString(timePeriodMillis)); + } + + /** + * Sets the time period during which the maximum request count is valid for * - * @param maximumConcurrentRequests the maximum number of concurrent requests + * @param timePeriodMillis period in millis + * @return the builder + */ + public ThrottleDefinition timePeriodMillis(String timePeriodMillis) { + setTimePeriodMillis(timePeriodMillis); + return this; + } + + /** + * Sets the maximum number of requests + * + * @param maximumConcurrentRequests the maximum number of requests (according to the mode in use - either + * concurrent or by time period) * @return the builder */ - public ThrottleDefinition maximumConcurrentRequests(long maximumConcurrentRequests) { + public ThrottleDefinition maximumRequests(long maximumConcurrentRequests) { setExpression( ExpressionNodeHelper.toExpressionDefinition(ExpressionBuilder.constantExpression(maximumConcurrentRequests))); return this; } /** - * Sets the number of concurrent requests + * Sets the maximum number of requests * - * @param maximumConcurrentRequests the maximum number of concurrent requests + * @param maximumConcurrentRequests the maximum number of requests (according to the mode in use - either + * concurrent or by time period) * @return the builder */ - public ThrottleDefinition maximumConcurrentRequests(String maximumConcurrentRequests) { + public ThrottleDefinition maximumRequests(String maximumConcurrentRequests) { setExpression( - ExpressionNodeHelper.toExpressionDefinition(ExpressionBuilder.simpleExpression(maximumConcurrentRequests))); + ExpressionNodeHelper.toExpressionDefinition(ExpressionBuilder.constantExpression(maximumConcurrentRequests))); return this; } + /** + * Sets the maximum number of concurrent requests + * + * @param maximumConcurrentRequests the maximum number of concurrent requests + * @deprecated Use {@link #maximumRequests(long)} + * @return the builder + */ + @Deprecated(since = "4.4.0") Review Comment: Great. I was trying not to be super disruptive, but it makes sense. It's even better if we can get rid of this. -- 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: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org