public class SamplingThrottler
extends org.apache.camel.support.AsyncProcessorSupport
implements org.apache.camel.Traceable, org.apache.camel.spi.IdAware, org.apache.camel.spi.RouteIdAware
SamplingThrottler is a special kind of throttler. It also limits the number of exchanges sent to a
downstream endpoint. It differs from a normal throttler in that it will not queue exchanges above the threshold for a
given period. Instead these exchanges will be stopped, precluding them from being processed at all by downstream
consumers.
This kind of throttling can be useful for taking a sample from an exchange stream, rough consolidation of noisy and
bursty exchange traffic or where queuing of throttled exchanges is undesirable.| Constructor and Description |
|---|
SamplingThrottler(long messageFrequency) |
SamplingThrottler(long samplePeriod,
TimeUnit units) |
| Modifier and Type | Method and Description |
|---|---|
String |
getId() |
long |
getMessageFrequency() |
String |
getRouteId() |
long |
getSamplePeriod() |
String |
getTraceLabel() |
TimeUnit |
getUnits() |
boolean |
process(org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback) |
void |
setId(String id) |
void |
setRouteId(String routeId) |
String |
toString() |
doStart, doStop, process, processAsyncbuild, 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, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic SamplingThrottler(long messageFrequency)
public SamplingThrottler(long samplePeriod,
TimeUnit units)
public String getId()
getId in interface org.apache.camel.spi.HasIdpublic void setId(String id)
setId in interface org.apache.camel.spi.IdAwarepublic String getRouteId()
getRouteId in interface org.apache.camel.spi.RouteIdAwarepublic void setRouteId(String routeId)
setRouteId in interface org.apache.camel.spi.RouteIdAwarepublic String getTraceLabel()
getTraceLabel in interface org.apache.camel.Traceablepublic long getMessageFrequency()
public long getSamplePeriod()
public TimeUnit getUnits()
public boolean process(org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback)
process in interface org.apache.camel.AsyncProcessorApache Camel