org.apache.camel.processor
Class Throttler
java.lang.Object
org.apache.camel.impl.ServiceSupport
org.apache.camel.processor.DelegateProcessor
org.apache.camel.processor.DelayProcessorSupport
org.apache.camel.processor.Throttler
- All Implemented Interfaces:
- Processor, Service
public class Throttler
- extends DelayProcessorSupport
A Throttler
will set a limit on the maximum number of message exchanges which can be sent
to a processor within a specific time period.
This pattern can be
extremely useful if you have some external system which meters access; such
as only allowing 100 requests per second; or if huge load can cause a
particular systme to malfunction or to reduce its throughput you might want
to introduce some throttling.
- Version:
- $Revision: 65754 $
Methods inherited from class org.apache.camel.impl.ServiceSupport |
addChildService, getThreadName, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, nextThreadCounter, removeChildService, start, stop |
Throttler
public Throttler(Processor processor,
long maximumRequestsPerPeriod)
Throttler
public Throttler(Processor processor,
long maximumRequestsPerPeriod,
long timePeriodMillis)
toString
public String toString()
- Overrides:
toString
in class DelegateProcessor
getMaximumRequestsPerPeriod
public long getMaximumRequestsPerPeriod()
setMaximumRequestsPerPeriod
public void setMaximumRequestsPerPeriod(long maximumRequestsPerPeriod)
- Sets the maximum number of requests per time period
getTimePeriodMillis
public long getTimePeriodMillis()
setTimePeriodMillis
public void setTimePeriodMillis(long timePeriodMillis)
- Sets the time period during which the maximum number of requests apply
delay
protected void delay(Exchange exchange)
throws Exception
- Specified by:
delay
in class DelayProcessorSupport
- Throws:
Exception
nextSlot
protected Throttler.TimeSlot nextSlot()
Copyright © 2009 IONA Open Source Community. All Rights Reserved.