[ 
https://issues.apache.org/jira/browse/CAMEL-6840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16515152#comment-16515152
 ] 

ASF GitHub Bot commented on CAMEL-6840:
---------------------------------------

davsclaus commented on a change in pull request #2376: CAMEL-6840 - add grouped 
throttling feature, both XML and Java DSL should be fine now.
URL: https://github.com/apache/camel/pull/2376#discussion_r195935728
 
 

 ##########
 File path: camel-core/src/main/java/org/apache/camel/processor/Throttler.java
 ##########
 @@ -61,25 +70,32 @@
 
     private static final String PROPERTY_EXCHANGE_QUEUED_TIMESTAMP = 
"CamelThrottlerExchangeQueuedTimestamp";
     private static final String PROPERTY_EXCHANGE_STATE = 
"CamelThrottlerExchangeState";
+    // (throttling grouping) defaulted as 1 because there will be only one 
queue which is similar to implementation
+    // when there is no grouping for throttling
+    private static final Integer NO_CORRELATION_QUEUE_ID = new Integer(1);
 
     private enum State { SYNC, ASYNC, ASYNC_REJECTED }
 
     private final Logger log = LoggerFactory.getLogger(Throttler.class);
     private final CamelContext camelContext;
-    private final DelayQueue<ThrottlePermit> delayQueue = new DelayQueue<>();
     private final ExecutorService asyncExecutor;
     private final boolean shutdownAsyncExecutor;
 
     private volatile long timePeriodMillis;
-    private volatile int throttleRate;
     private String id;
     private Expression maxRequestsPerPeriodExpression;
     private boolean rejectExecution;
     private boolean asyncDelayed;
     private boolean callerRunsWhenRejected = true;
+    private Expression correlationExpression;
+    // below 2 fields added for (throttling grouping)
+    private Map<Integer, DelayQueue<ThrottlePermit>> delayQueueCache;
 
 Review comment:
   Wont the delay queue empty itself when the time period has elapsed, and then 
release the exchanges. So even if you have many correlation keys then they 
would eventually be released. And yeah clean in shutdown is good practice 
(although Camel ought to do graceful shutdown and wait for those throttled 
exchanges to complete first).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Allow Throttler EIP to specify SLA per client/correlated-group
> --------------------------------------------------------------
>
>                 Key: CAMEL-6840
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6840
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-core, eip
>            Reporter: Christian Posta
>            Assignee: Önder Sezgin
>            Priority: Major
>             Fix For: 2.22.0
>
>
> Basic idea is to allow throttler to have a predicate to determine whether or 
> not to apply throttling to that exchange. 
> From this Mailing List discussion:
> http://camel.465427.n5.nabble.com/Throttling-by-client-ID-td5741032.html



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to