Class ThrottlingInflightRoutePolicy

    • Field Summary

      • Fields inherited from class org.apache.camel.support.service.BaseService

        BUILDED, FAILED, INITIALIZED, INITIALIZING, NEW, SHUTDOWN, SHUTTINGDOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.apache.camel.spi.CamelLogger createLogger()  
      protected void doStart()  
      protected void doStop()  
      org.apache.camel.CamelContext getCamelContext()  
      org.apache.camel.spi.CamelLogger getLogger()  
      org.apache.camel.LoggingLevel getLoggingLevel()  
      int getMaxInflightExchanges()  
      int getResumePercentOfMax()  
      ThrottlingInflightRoutePolicy.ThrottlingScope getScope()  
      void onExchangeDone​(org.apache.camel.Route route, org.apache.camel.Exchange exchange)  
      void onInit​(org.apache.camel.Route route)  
      void setCamelContext​(org.apache.camel.CamelContext camelContext)  
      void setLogger​(org.apache.camel.spi.CamelLogger logger)
      Sets the logger to use for logging throttling activity.
      void setLoggingLevel​(org.apache.camel.LoggingLevel loggingLevel)
      Sets the logging level to report the throttling activity.
      void setMaxInflightExchanges​(int maxInflightExchanges)
      Sets the upper limit of number of concurrent inflight exchanges at which point reached the throttler should suspend the route.
      void setResumePercentOfMax​(int resumePercentOfMax)
      Sets at which percentage of the max the throttler should start resuming the route.
      void setScope​(ThrottlingInflightRoutePolicy.ThrottlingScope scope)
      Sets which scope the throttling should be based upon, either route or total scoped.
      protected void throttle​(org.apache.camel.Route route, org.apache.camel.Exchange exchange)
      Throttles the route when Exchanges is done.
      String toString()  
      • Methods inherited from class org.apache.camel.support.RoutePolicySupport

        controller, getExceptionHandler, handleException, onExchangeBegin, onRemove, onResume, onStart, onStop, onSuspend, resumeOrStartConsumer, resumeRoute, setExceptionHandler, startConsumer, startRoute, stopConsumer, stopRoute, stopRoute, stopRouteAsync, suspendOrStopConsumer, suspendRoute, suspendRoute
      • Methods inherited from class org.apache.camel.support.service.BaseService

        build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
      • Methods inherited from interface org.apache.camel.Service

        build, close, init, start, stop
      • Methods inherited from interface org.apache.camel.ShutdownableService

        shutdown
      • Methods inherited from interface org.apache.camel.StatefulService

        getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
      • Methods inherited from interface org.apache.camel.SuspendableService

        isSuspended, resume, suspend
    • Constructor Detail

      • ThrottlingInflightRoutePolicy

        public ThrottlingInflightRoutePolicy()
    • Method Detail

      • getCamelContext

        public org.apache.camel.CamelContext getCamelContext()
        Specified by:
        getCamelContext in interface org.apache.camel.CamelContextAware
      • setCamelContext

        public void setCamelContext​(org.apache.camel.CamelContext camelContext)
        Specified by:
        setCamelContext in interface org.apache.camel.CamelContextAware
      • onInit

        public void onInit​(org.apache.camel.Route route)
        Specified by:
        onInit in interface org.apache.camel.spi.RoutePolicy
        Overrides:
        onInit in class org.apache.camel.support.RoutePolicySupport
      • onExchangeDone

        public void onExchangeDone​(org.apache.camel.Route route,
                                   org.apache.camel.Exchange exchange)
        Specified by:
        onExchangeDone in interface org.apache.camel.spi.RoutePolicy
        Overrides:
        onExchangeDone in class org.apache.camel.support.RoutePolicySupport
      • throttle

        protected void throttle​(org.apache.camel.Route route,
                                org.apache.camel.Exchange exchange)
        Throttles the route when Exchanges is done.
        Parameters:
        route - the route
        exchange - the exchange
      • getMaxInflightExchanges

        public int getMaxInflightExchanges()
      • setMaxInflightExchanges

        public void setMaxInflightExchanges​(int maxInflightExchanges)
        Sets the upper limit of number of concurrent inflight exchanges at which point reached the throttler should suspend the route.

        Is default 1000.

        Parameters:
        maxInflightExchanges - the upper limit of concurrent inflight exchanges
      • getResumePercentOfMax

        public int getResumePercentOfMax()
      • setResumePercentOfMax

        public void setResumePercentOfMax​(int resumePercentOfMax)
        Sets at which percentage of the max the throttler should start resuming the route.

        Will by default use 70%.

        Parameters:
        resumePercentOfMax - the percentage must be between 0 and 100
      • getLoggingLevel

        public org.apache.camel.LoggingLevel getLoggingLevel()
      • getLogger

        public org.apache.camel.spi.CamelLogger getLogger()
      • setLogger

        public void setLogger​(org.apache.camel.spi.CamelLogger logger)
        Sets the logger to use for logging throttling activity.
        Parameters:
        logger - the logger
      • setLoggingLevel

        public void setLoggingLevel​(org.apache.camel.LoggingLevel loggingLevel)
        Sets the logging level to report the throttling activity.

        Is default INFO level.

        Parameters:
        loggingLevel - the logging level
      • createLogger

        protected org.apache.camel.spi.CamelLogger createLogger()
      • doStart

        protected void doStart()
                        throws Exception
        Overrides:
        doStart in class org.apache.camel.support.RoutePolicySupport
        Throws:
        Exception
      • doStop

        protected void doStop()
                       throws Exception
        Overrides:
        doStop in class org.apache.camel.support.RoutePolicySupport
        Throws:
        Exception