Package org.apache.camel.model
Class ThreadsDefinition
- java.lang.Object
-
- org.apache.camel.model.OptionalIdentifiedDefinition<Type>
-
- org.apache.camel.model.ProcessorDefinition<Type>
-
- org.apache.camel.model.NoOutputDefinition<ThreadsDefinition>
-
- org.apache.camel.model.ThreadsDefinition
-
- All Implemented Interfaces:
org.apache.camel.ExecutorServiceAware
,Block
,ExecutorServiceAwareDefinition<ThreadsDefinition>
,org.apache.camel.NamedNode
,org.apache.camel.spi.HasId
,org.apache.camel.spi.IdAware
@Metadata(label="eip,routing") public class ThreadsDefinition extends NoOutputDefinition<ThreadsDefinition> implements ExecutorServiceAwareDefinition<ThreadsDefinition>
Specifies that all steps after this node are processed asynchronously
-
-
Field Summary
-
Fields inherited from class org.apache.camel.model.ProcessorDefinition
inheritErrorHandler, log
-
-
Constructor Summary
Constructors Constructor Description ThreadsDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThreadsDefinition
allowCoreThreadTimeOut(boolean allowCoreThreadTimeOut)
Whether idle core threads are allowed to timeout and therefore can shrink the pool size below the core pool sizeThreadsDefinition
allowCoreThreadTimeOut(String allowCoreThreadTimeOut)
Whether idle core threads is allowed to timeout and therefore can shrink the pool size below the core pool sizeThreadsDefinition
callerRunsWhenRejected(boolean callerRunsWhenRejected)
Whether or not to use as caller runs as fallback when a task is rejected being added to the thread pool (when its full).ThreadsDefinition
callerRunsWhenRejected(String callerRunsWhenRejected)
Whether or not to use as caller runs as fallback when a task is rejected being added to the thread pool (when its full).ThreadsDefinition
executorService(ExecutorService executorService)
To use a custom thread poolThreadsDefinition
executorServiceRef(String executorServiceRef)
To refer to a custom thread pool or use a thread pool profile (as overlay)String
getAllowCoreThreadTimeOut()
String
getCallerRunsWhenRejected()
ExecutorService
getExecutorService()
String
getExecutorServiceRef()
String
getKeepAliveTime()
String
getLabel()
Returns a label to describe this node such as the expression if some kind of expression nodeString
getMaxPoolSize()
String
getMaxQueueSize()
String
getPoolSize()
String
getRejectedPolicy()
String
getShortName()
String
getThreadName()
String
getTimeUnit()
ThreadsDefinition
keepAliveTime(long keepAliveTime)
Sets the keep alive time for idle threadsThreadsDefinition
keepAliveTime(String keepAliveTime)
Sets the keep alive time for idle threadsThreadsDefinition
maxPoolSize(int maxPoolSize)
Sets the maximum pool sizeThreadsDefinition
maxPoolSize(String maxPoolSize)
Sets the maximum pool sizeThreadsDefinition
maxQueueSize(int maxQueueSize)
Sets the maximum number of tasks in the work queue.ThreadsDefinition
maxQueueSize(String maxQueueSize)
Sets the maximum number of tasks in the work queue.ThreadsDefinition
poolSize(int poolSize)
Sets the core pool sizeThreadsDefinition
poolSize(String poolSize)
Sets the core pool sizeThreadsDefinition
rejectedPolicy(String rejectedPolicy)
Sets the handler for tasks which cannot be executed by the thread pool.ThreadsDefinition
rejectedPolicy(org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy rejectedPolicy)
Sets the handler for tasks which cannot be executed by the thread pool.void
setAllowCoreThreadTimeOut(String allowCoreThreadTimeOut)
void
setCallerRunsWhenRejected(String callerRunsWhenRejected)
void
setExecutorService(ExecutorService executorService)
void
setExecutorServiceRef(String executorServiceRef)
void
setKeepAliveTime(String keepAliveTime)
void
setMaxPoolSize(String maxPoolSize)
void
setMaxQueueSize(String maxQueueSize)
void
setPoolSize(String poolSize)
void
setRejectedPolicy(String rejectedPolicy)
void
setThreadName(String threadName)
void
setTimeUnit(String timeUnit)
ThreadsDefinition
threadName(String threadName)
Sets the thread name to use.ThreadsDefinition
timeUnit(String keepAliveTimeUnits)
Sets the keep alive time unit.ThreadsDefinition
timeUnit(TimeUnit keepAliveTimeUnits)
Sets the keep alive time unit.String
toString()
-
Methods inherited from class org.apache.camel.model.NoOutputDefinition
getOutputs
-
Methods inherited from class org.apache.camel.model.ProcessorDefinition
addInterceptStrategy, addOutput, aggregate, aggregate, aggregate, aggregate, bean, bean, bean, bean, bean, bean, bean, bean, bean, bean, bean, choice, circuitBreaker, claimCheck, claimCheck, claimCheck, claimCheck, clearOutput, configureChild, convertBodyTo, convertBodyTo, convertBodyTo, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endCircuitBreaker, endDoCatch, endDoTry, endParent, endRest, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, filter, filter, filter, filter, getIndex, getInterceptStrategies, getParent, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, isAbstract, isInheritErrorHandler, isTopLevelOnly, isWrappingEntireOutput, kamelet, loadBalance, loadBalance, log, log, log, log, log, log, loop, loop, loop, loopDoWhile, loopDoWhile, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, onCompletion, onException, onException, pipeline, pipeline, pipeline, pipeline, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, preCreateProcessor, process, process, process, recipientList, recipientList, recipientList, recipientList, removeHeader, removeHeaders, removeHeaders, removeProperties, removeProperties, removeProperty, resequence, resequence, rollback, rollback, routeDescription, routeGroup, routeId, routingSlip, routingSlip, routingSlip, saga, sample, sample, sample, sample, script, script, serviceCall, serviceCall, serviceCall, setBody, setBody, setBody, setExchangePattern, setHeader, setHeader, setHeader, setInheritErrorHandler, setParent, setProperty, setProperty, setProperty, sort, sort, sort, split, split, split, split, startupOrder, step, step, stop, threads, threads, threads, threads, throttle, throttle, throttle, throttle, throttle, throwException, throwException, to, to, to, to, to, to, to, to, to, to, to, to, to, to, toD, toD, toD, toD, toD, toD, toD, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap
-
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, description, getCustomId, getDescription, getDescriptionText, getId, hasCustomIdAssigned, idOrCreate, setCustomId, setDescription, setGeneratedId, setId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.camel.model.ExecutorServiceAwareDefinition
executorService
-
-
-
-
Method Detail
-
getShortName
public String getShortName()
- Specified by:
getShortName
in interfaceorg.apache.camel.NamedNode
-
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- Specified by:
getLabel
in interfaceorg.apache.camel.NamedNode
- Overrides:
getLabel
in classProcessorDefinition<ThreadsDefinition>
-
executorService
public ThreadsDefinition executorService(ExecutorService executorService)
To use a custom thread pool- Specified by:
executorService
in interfaceExecutorServiceAwareDefinition<ThreadsDefinition>
- Parameters:
executorService
- the executor service- Returns:
- the builder
-
executorServiceRef
public ThreadsDefinition executorServiceRef(String executorServiceRef)
To refer to a custom thread pool or use a thread pool profile (as overlay)- Specified by:
executorServiceRef
in interfaceExecutorServiceAwareDefinition<ThreadsDefinition>
- Parameters:
executorServiceRef
- reference for aExecutorService
to lookup in theRegistry
- Returns:
- the builder
-
poolSize
public ThreadsDefinition poolSize(int poolSize)
Sets the core pool size- Parameters:
poolSize
- the core pool size to keep minimum in the pool- Returns:
- the builder
-
poolSize
public ThreadsDefinition poolSize(String poolSize)
Sets the core pool size- Parameters:
poolSize
- the core pool size to keep minimum in the pool- Returns:
- the builder
-
maxPoolSize
public ThreadsDefinition maxPoolSize(int maxPoolSize)
Sets the maximum pool size- Parameters:
maxPoolSize
- the maximum pool size- Returns:
- the builder
-
maxPoolSize
public ThreadsDefinition maxPoolSize(String maxPoolSize)
Sets the maximum pool size- Parameters:
maxPoolSize
- the maximum pool size- Returns:
- the builder
-
keepAliveTime
public ThreadsDefinition keepAliveTime(long keepAliveTime)
Sets the keep alive time for idle threads- Parameters:
keepAliveTime
- keep alive time- Returns:
- the builder
-
keepAliveTime
public ThreadsDefinition keepAliveTime(String keepAliveTime)
Sets the keep alive time for idle threads- Parameters:
keepAliveTime
- keep alive time- Returns:
- the builder
-
timeUnit
public ThreadsDefinition timeUnit(TimeUnit keepAliveTimeUnits)
Sets the keep alive time unit. By default SECONDS is used.- Parameters:
keepAliveTimeUnits
- time unit- Returns:
- the builder
-
timeUnit
public ThreadsDefinition timeUnit(String keepAliveTimeUnits)
Sets the keep alive time unit. By default SECONDS is used.- Parameters:
keepAliveTimeUnits
- time unit- Returns:
- the builder
-
maxQueueSize
public ThreadsDefinition maxQueueSize(int maxQueueSize)
Sets the maximum number of tasks in the work queue. Use -1 or Integer.MAX_VALUE for an unbounded queue- Parameters:
maxQueueSize
- the max queue size- Returns:
- the builder
-
maxQueueSize
public ThreadsDefinition maxQueueSize(String maxQueueSize)
Sets the maximum number of tasks in the work queue. Use -1 or Integer.MAX_VALUE for an unbounded queue- Parameters:
maxQueueSize
- the max queue size- Returns:
- the builder
-
rejectedPolicy
public ThreadsDefinition rejectedPolicy(org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy rejectedPolicy)
Sets the handler for tasks which cannot be executed by the thread pool.- Parameters:
rejectedPolicy
- the policy for the handler- Returns:
- the builder
-
rejectedPolicy
public ThreadsDefinition rejectedPolicy(String rejectedPolicy)
Sets the handler for tasks which cannot be executed by the thread pool.- Parameters:
rejectedPolicy
- the policy for the handler- Returns:
- the builder
-
threadName
public ThreadsDefinition threadName(String threadName)
Sets the thread name to use.- Parameters:
threadName
- the thread name- Returns:
- the builder
-
callerRunsWhenRejected
public ThreadsDefinition callerRunsWhenRejected(boolean callerRunsWhenRejected)
Whether or not to use as caller runs as fallback when a task is rejected being added to the thread pool (when its full). This is only used as fallback if no rejectedPolicy has been configured, or the thread pool has no configured rejection handler. Is by default true- Parameters:
callerRunsWhenRejected
- whether or not the caller should run- Returns:
- the builder
-
callerRunsWhenRejected
public ThreadsDefinition callerRunsWhenRejected(String callerRunsWhenRejected)
Whether or not to use as caller runs as fallback when a task is rejected being added to the thread pool (when its full). This is only used as fallback if no rejectedPolicy has been configured, or the thread pool has no configured rejection handler. Is by default true- Parameters:
callerRunsWhenRejected
- whether or not the caller should run- Returns:
- the builder
-
allowCoreThreadTimeOut
public ThreadsDefinition allowCoreThreadTimeOut(boolean allowCoreThreadTimeOut)
Whether idle core threads are allowed to timeout and therefore can shrink the pool size below the core pool size Is by default false- Parameters:
allowCoreThreadTimeOut
- true to allow timeout- Returns:
- the builder
-
allowCoreThreadTimeOut
public ThreadsDefinition allowCoreThreadTimeOut(String allowCoreThreadTimeOut)
Whether idle core threads is allowed to timeout and therefore can shrink the pool size below the core pool size Is by default false- Parameters:
allowCoreThreadTimeOut
- true to allow timeout- Returns:
- the builder
-
getExecutorService
public ExecutorService getExecutorService()
- Specified by:
getExecutorService
in interfaceorg.apache.camel.ExecutorServiceAware
-
setExecutorService
public void setExecutorService(ExecutorService executorService)
- Specified by:
setExecutorService
in interfaceorg.apache.camel.ExecutorServiceAware
-
getExecutorServiceRef
public String getExecutorServiceRef()
- Specified by:
getExecutorServiceRef
in interfaceorg.apache.camel.ExecutorServiceAware
-
setExecutorServiceRef
public void setExecutorServiceRef(String executorServiceRef)
- Specified by:
setExecutorServiceRef
in interfaceorg.apache.camel.ExecutorServiceAware
-
getPoolSize
public String getPoolSize()
-
setPoolSize
public void setPoolSize(String poolSize)
-
getMaxPoolSize
public String getMaxPoolSize()
-
setMaxPoolSize
public void setMaxPoolSize(String maxPoolSize)
-
getKeepAliveTime
public String getKeepAliveTime()
-
setKeepAliveTime
public void setKeepAliveTime(String keepAliveTime)
-
getTimeUnit
public String getTimeUnit()
-
setTimeUnit
public void setTimeUnit(String timeUnit)
-
getMaxQueueSize
public String getMaxQueueSize()
-
setMaxQueueSize
public void setMaxQueueSize(String maxQueueSize)
-
getThreadName
public String getThreadName()
-
setThreadName
public void setThreadName(String threadName)
-
getRejectedPolicy
public String getRejectedPolicy()
-
setRejectedPolicy
public void setRejectedPolicy(String rejectedPolicy)
-
getCallerRunsWhenRejected
public String getCallerRunsWhenRejected()
-
setCallerRunsWhenRejected
public void setCallerRunsWhenRejected(String callerRunsWhenRejected)
-
getAllowCoreThreadTimeOut
public String getAllowCoreThreadTimeOut()
-
setAllowCoreThreadTimeOut
public void setAllowCoreThreadTimeOut(String allowCoreThreadTimeOut)
-
-