public class Throttler
extends org.apache.camel.support.AsyncProcessorSupport
implements org.apache.camel.Traceable, org.apache.camel.spi.IdAware, org.apache.camel.spi.RouteIdAware
Constructor and Description |
---|
Throttler(org.apache.camel.CamelContext camelContext,
org.apache.camel.Expression maxRequestsPerPeriodExpression,
long timePeriodMillis,
ScheduledExecutorService asyncExecutor,
boolean shutdownAsyncExecutor,
boolean rejectExecution,
org.apache.camel.Expression correlation) |
Modifier and Type | Method and Description |
---|---|
protected void |
doShutdown() |
protected void |
doStart() |
protected void |
doStop() |
int |
getCurrentMaximumRequestsPerPeriod()
Gets the current maximum request per period value.
|
String |
getId() |
org.apache.camel.Expression |
getMaximumRequestsPerPeriodExpression() |
String |
getRouteId() |
long |
getTimePeriodMillis() |
String |
getTraceLabel() |
boolean |
isAsyncDelayed() |
boolean |
isCallerRunsWhenRejected() |
boolean |
isRejectExecution() |
boolean |
process(org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback) |
protected boolean |
processAsynchronously(org.apache.camel.Exchange exchange,
org.apache.camel.AsyncCallback callback,
org.apache.camel.processor.Throttler.ThrottlingState throttlingState)
Delegate blocking on the DelayQueue to an asyncExecutor.
|
void |
setAsyncDelayed(boolean asyncDelayed) |
void |
setCallerRunsWhenRejected(boolean callerRunsWhenRejected) |
void |
setId(String id) |
void |
setMaximumRequestsPerPeriodExpression(org.apache.camel.Expression maxRequestsPerPeriodExpression)
Sets the maximum number of requests per time period expression
|
void |
setRejectExecution(boolean rejectExecution) |
void |
setRouteId(String routeId) |
void |
setTimePeriodMillis(long timePeriodMillis)
Sets the time period during which the maximum number of requests apply
|
String |
toString() |
build, doBuild, doInit, doResume, doSuspend, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public Throttler(org.apache.camel.CamelContext camelContext, org.apache.camel.Expression maxRequestsPerPeriodExpression, long timePeriodMillis, ScheduledExecutorService asyncExecutor, boolean shutdownAsyncExecutor, boolean rejectExecution, org.apache.camel.Expression correlation)
public boolean process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)
process
in interface org.apache.camel.AsyncProcessor
protected boolean processAsynchronously(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback, org.apache.camel.processor.Throttler.ThrottlingState throttlingState)
protected void doStart() throws Exception
doStart
in class org.apache.camel.support.AsyncProcessorSupport
Exception
protected void doStop() throws Exception
doStop
in class org.apache.camel.support.AsyncProcessorSupport
Exception
protected void doShutdown() throws Exception
doShutdown
in class org.apache.camel.support.service.ServiceSupport
Exception
public boolean isRejectExecution()
public void setRejectExecution(boolean rejectExecution)
public boolean isAsyncDelayed()
public void setAsyncDelayed(boolean asyncDelayed)
public boolean isCallerRunsWhenRejected()
public void setCallerRunsWhenRejected(boolean callerRunsWhenRejected)
public String getId()
getId
in interface org.apache.camel.spi.HasId
public void setId(String id)
setId
in interface org.apache.camel.spi.IdAware
public String getRouteId()
getRouteId
in interface org.apache.camel.spi.RouteIdAware
public void setRouteId(String routeId)
setRouteId
in interface org.apache.camel.spi.RouteIdAware
public void setMaximumRequestsPerPeriodExpression(org.apache.camel.Expression maxRequestsPerPeriodExpression)
public org.apache.camel.Expression getMaximumRequestsPerPeriodExpression()
public int getCurrentMaximumRequestsPerPeriod()
public void setTimePeriodMillis(long timePeriodMillis)
public long getTimePeriodMillis()
public String getTraceLabel()
getTraceLabel
in interface org.apache.camel.Traceable
Apache Camel