...
In Java DSL you can configure the default thread pool profile from the ExecutorServiceStartegy
which you access from CamelContext
.
Using thread pool profiles
Suppose you want to use a custom thread pool profile for a Multicast EIP pattern in a Camel route you can do it using the executorServiceRef
attribute as shown:
Code Block | ||||
---|---|---|---|---|
| ||||
<camelContext ...>
...
<threadPoolProfile id="fooProfile"
poolSize="20" maxPoolSize="50" maxQueueSize="-1"/>
...
<route>
...
<multicast strategyRef="myStrategy" executorServiceRef="fooProfile">
...
</multicast>
...
<route>
</camelContext>
|
What Camel will do at runtime is to lookup in the Registry for a ExecutorService
with the id = fooProfile. If none found it will fallback and see if there is a ThreadPoolProfile
defined with that id. And in this example there is and so the profile is used for creating a new ExecutorService
which is handed back to the Multicast EIP to use in the route.
Create custom thread pool
...