Camel
  1. Camel
  2. CAMEL-5599

Throttler EIP - Add support for throttling based on grouping

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.10.0
    • Fix Version/s: Future
    • Component/s: camel-core, eip
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      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.

        Activity

        Hide
        Rene Avontuur added a comment -

        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:

        @XmlTransient
        private ThrottlerStrategy throttlerStrategy;
        

        The ThrottlerStrategy interface will look like:

        public interface ThrottlerStrategy {
            long calculateDelay(Exchange exchange) throws CamelExchangeException;
            void setMaximumRequestsPerPeriod(long maximumRequestsPerPeriod);
            void setTimePeriodMillis(AtomicLong timePeriodMillis);
        }
        

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

        Show
        Rene Avontuur added a comment - 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: @XmlTransient private ThrottlerStrategy throttlerStrategy; The ThrottlerStrategy interface will look like: public interface ThrottlerStrategy { long calculateDelay(Exchange exchange) throws CamelExchangeException; void setMaximumRequestsPerPeriod( long maximumRequestsPerPeriod); void setTimePeriodMillis(AtomicLong timePeriodMillis); } I am not sure if extending the API with an optional strategy is regarded as backwards compatible.

          People

          • Assignee:
            Unassigned
            Reporter:
            Claus Ibsen
          • Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:

              Development