Reputation: 5126
I use apache camel-cdi and wildfly 8.2. How to configurate thread pool for camel? In documentation I only see config for spring, but I use java ee with wildfly
Upvotes: 1
Views: 748
Reputation: 71
You can check Java DSL configuration to create a thread pool in Camel.
import org.apache.camel.spi.ExecutorServiceManager; import org.apache.camel.spi.ThreadPoolProfile; ExecutorServiceManager manager = context.getExecutorServiceManager(); ThreadPoolProfile defaultProfile = manager.getDefaultThreadPoolProfile(); // Now, customize the profile settings. defaultProfile.setPoolSize(SomeSize); defaultProfile.setMaxQueueSize(QueueSize);
Upvotes: 1
Reputation: 579
This depends on your use case but you can definitely use thread pooling with Camel Java DSL. The format would be something like the below:
ExecutorService threadPool = Executors.newFixedThreadPool(20);
.split(body().tokenize("\n")).streaming().executorService(threadPool)
Individual components can also allow for individual threading (see file2 for example). If you have the Camel in Action book, chapter 10 is all about concurrency. It goes into threading and concurrency in much more detail.
Upvotes: 0