org.apache.camel.model
Class ThrottleDefinition

java.lang.Object
  extended by org.apache.camel.model.OptionalIdentifiedDefinition<Type>
      extended by org.apache.camel.model.ProcessorDefinition<ExpressionNode>
          extended by org.apache.camel.model.ExpressionNode
              extended by org.apache.camel.model.ThrottleDefinition
All Implemented Interfaces:
ExecutorServiceAware, Block, ExecutorServiceAwareDefinition<ThrottleDefinition>, NamedNode

public class ThrottleDefinition
extends ExpressionNode
implements ExecutorServiceAwareDefinition<ThrottleDefinition>

Represents an XML <throttle/> element

Version:

Field Summary
 
Fields inherited from class org.apache.camel.model.ProcessorDefinition
inheritErrorHandler, log
 
Constructor Summary
ThrottleDefinition()
           
ThrottleDefinition(Expression maximumRequestsPerPeriod)
           
 
Method Summary
 ThrottleDefinition asyncDelayed()
          Enables asynchronous delay which means the thread will noy block while delaying.
 ThrottleDefinition callerRunsWhenRejected(boolean callerRunsWhenRejected)
          Whether or not the caller should run the task when it was rejected by the thread pool.
 Processor createProcessor(RouteContext routeContext)
          Override this in definition class and implement logic to create the processor based on the definition model.
protected  String description()
           
 ThrottleDefinition executorService(ExecutorService executorService)
          Setting the executor service for executing
 ThrottleDefinition executorServiceRef(String executorServiceRef)
          Setting the executor service for executing
 Boolean getAsyncDelayed()
           
 Boolean getCallerRunsWhenRejected()
           
 ExecutorService getExecutorService()
          Gets the executor service
 String getExecutorServiceRef()
          Gets the reference to lookup in the Registry for the executor service to be used.
 String getLabel()
          Returns a label to describe this node such as the expression if some kind of expression node
 String getShortName()
          Returns a short name for this node which can be useful for ID generation or referring to related resources like images
 Long getTimePeriodMillis()
           
 boolean isAsyncDelayed()
           
 ThrottleDefinition maximumRequestsPerPeriod(Long maximumRequestsPerPeriod)
          Sets the time period during which the maximum request count per period
 void setAsyncDelayed(Boolean asyncDelayed)
           
 void setCallerRunsWhenRejected(Boolean callerRunsWhenRejected)
           
 void setExecutorService(ExecutorService executorService)
          Sets the executor service to be used.
 void setExecutorServiceRef(String executorServiceRef)
          Sets a reference to lookup in the Registry for the executor service to be used.
 void setTimePeriodMillis(Long timePeriodMillis)
           
 ThrottleDefinition timePeriodMillis(long timePeriodMillis)
          Sets the time period during which the maximum request count is valid for
 String toString()
           
 
Methods inherited from class org.apache.camel.model.ExpressionNode
configureChild, createFilterProcessor, createPredicate, getExpression, getOutputs, isOutputSupported, preCreateProcessor, setExpression, setOutputs
 
Methods inherited from class org.apache.camel.model.ProcessorDefinition
addInterceptStrategies, addInterceptStrategy, addOutput, addRoutes, aggregate, aggregate, aggregate, aggregate, aop, attribute, bean, bean, bean, bean, beanRef, beanRef, choice, clearOutput, convertBodyTo, convertBodyTo, createChannel, createChildProcessor, createCompositeProcessor, createOutputsProcessor, createOutputsProcessor, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endDoTry, endParent, enrich, enrich, enrichRef, filter, filter, filter, filter, getInterceptStrategies, getNodeFactory, getOtherAttributes, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, inOut, isAbstract, isInheritErrorHandler, loadBalance, loadBalance, log, log, log, log, loop, loop, loop, makeProcessor, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, onException, pipeline, pipeline, pipeline, pipeline, placeholder, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichRef, process, processRef, recipientList, recipientList, recipientList, removeFaultHeader, removeHeader, removeHeaders, removeHeaders, removeProperty, resequence, resequence, resolveKnownConstantFields, resolvePropertyPlaceholders, rollback, rollback, routeId, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, routingSlip, sample, sample, sample, setBody, setBody, setExchangePattern, setFaultBody, setFaultHeader, setHeader, setHeader, setInheritErrorHandler, setNodeFactory, setOtherAttributes, setOutHeader, setOutHeader, setParent, setProperty, setProperty, sort, sort, sort, split, split, split, stop, threads, threads, threads, threads, throttle, throttle, throwException, to, to, to, to, to, to, to, to, to, to, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wireTap, wrapChannel, wrapInErrorHandler, wrapProcessor
 
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, getDescription, getDescriptionText, getId, hasCustomIdAssigned, idOrCreate, setDescription, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThrottleDefinition

public ThrottleDefinition()

ThrottleDefinition

public ThrottleDefinition(Expression maximumRequestsPerPeriod)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

description

protected String description()

getShortName

public String getShortName()
Description copied from class: OptionalIdentifiedDefinition
Returns a short name for this node which can be useful for ID generation or referring to related resources like images

Specified by:
getShortName in interface NamedNode
Overrides:
getShortName in class ExpressionNode
Returns:
defaults to "node" but derived nodes should overload this to provide a unique name

getLabel

public String getLabel()
Description copied from class: ProcessorDefinition
Returns a label to describe this node such as the expression if some kind of expression node

Overrides:
getLabel in class ExpressionNode

createProcessor

public Processor createProcessor(RouteContext routeContext)
                          throws Exception
Description copied from class: ProcessorDefinition
Override this in definition class and implement logic to create the processor based on the definition model.

Overrides:
createProcessor in class ProcessorDefinition<ExpressionNode>
Throws:
Exception

timePeriodMillis

public ThrottleDefinition timePeriodMillis(long timePeriodMillis)
Sets the time period during which the maximum request count is valid for

Parameters:
timePeriodMillis - period in millis
Returns:
the builder

maximumRequestsPerPeriod

public ThrottleDefinition maximumRequestsPerPeriod(Long maximumRequestsPerPeriod)
Sets the time period during which the maximum request count per period

Parameters:
maximumRequestsPerPeriod - the maximum request count number per time period
Returns:
the builder

callerRunsWhenRejected

public ThrottleDefinition callerRunsWhenRejected(boolean callerRunsWhenRejected)
Whether or not the caller should run the task when it was rejected by the thread pool.

Is by default true

Parameters:
callerRunsWhenRejected - whether or not the caller should run
Returns:
the builder

asyncDelayed

public ThrottleDefinition asyncDelayed()
Enables asynchronous delay which means the thread will noy block while delaying.

Returns:
the builder

executorService

public ThrottleDefinition executorService(ExecutorService executorService)
Description copied from interface: ExecutorServiceAwareDefinition
Setting the executor service for executing

Specified by:
executorService in interface ExecutorServiceAwareDefinition<ThrottleDefinition>
Parameters:
executorService - the executor service
Returns:
the builder

executorServiceRef

public ThrottleDefinition executorServiceRef(String executorServiceRef)
Description copied from interface: ExecutorServiceAwareDefinition
Setting the executor service for executing

Specified by:
executorServiceRef in interface ExecutorServiceAwareDefinition<ThrottleDefinition>
Parameters:
executorServiceRef - reference for a ExecutorService to lookup in the Registry
Returns:
the builder

getTimePeriodMillis

public Long getTimePeriodMillis()

setTimePeriodMillis

public void setTimePeriodMillis(Long timePeriodMillis)

getAsyncDelayed

public Boolean getAsyncDelayed()

setAsyncDelayed

public void setAsyncDelayed(Boolean asyncDelayed)

isAsyncDelayed

public boolean isAsyncDelayed()

getCallerRunsWhenRejected

public Boolean getCallerRunsWhenRejected()

setCallerRunsWhenRejected

public void setCallerRunsWhenRejected(Boolean callerRunsWhenRejected)

getExecutorService

public ExecutorService getExecutorService()
Description copied from interface: ExecutorServiceAware
Gets the executor service

Specified by:
getExecutorService in interface ExecutorServiceAware
Returns:
the executor

setExecutorService

public void setExecutorService(ExecutorService executorService)
Description copied from interface: ExecutorServiceAware
Sets the executor service to be used.

Specified by:
setExecutorService in interface ExecutorServiceAware
Parameters:
executorService - the executor

getExecutorServiceRef

public String getExecutorServiceRef()
Description copied from interface: ExecutorServiceAware
Gets the reference to lookup in the Registry for the executor service to be used.

Specified by:
getExecutorServiceRef in interface ExecutorServiceAware
Returns:
the reference, or null if the executor was set directly

setExecutorServiceRef

public void setExecutorServiceRef(String executorServiceRef)
Description copied from interface: ExecutorServiceAware
Sets a reference to lookup in the Registry for the executor service to be used.

Specified by:
setExecutorServiceRef in interface ExecutorServiceAware
Parameters:
executorServiceRef - reference for the executor


Apache CAMEL