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

Rene Avontuur commented on CAMEL-5599:
--------------------------------------

I wonder if introducing a pluggable strategy would be helpful here.
This would give end users the option to use another predefined throttle 
strategy or even the option to write an own implementation.
A default strategy ensures backwards compatibility with respect to current 
behaviour of the throttler. 

The idea is to extend the ThrottlerDefinition class with: 
{code}
@XmlTransient
private ThrottlerStrategy throttlerStrategy;
{code}

The ThrottlerStrategy interface will look like:
{code}
public interface ThrottlerStrategy {
    long calculateDelay(Exchange exchange) throws CamelExchangeException;
    void setMaximumRequestsPerPeriod(long maximumRequestsPerPeriod);
    void setTimePeriodMillis(AtomicLong timePeriodMillis);
}
{code}

I am not sure if extending the API with an optional strategy is regarded as 
backwards compatible. 


> Throttler EIP - Add support for throttling based on grouping
> ------------------------------------------------------------
>
>                 Key: CAMEL-5599
>                 URL: https://issues.apache.org/jira/browse/CAMEL-5599
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core, eip
>    Affects Versions: 2.10.0
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: Future
>
>
> See
> http://stackoverflow.com/questions/12368944/throttling-based-on-content
> It would be nice if we could add an expression to the throttler. So it would 
> use that as grouping (eg alike correlation expression in the aggregator). 
> Then you can use that to throttle messages differently.
> The tricky part is to keep API backwards compatible and add the same time add 
> optional expression in the DSL.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to