Actually, looking at the comments in the Camel code I wonder if I should simply implement a custom ThreadPoolFactory rather than an ExecutorServiceManager.
On Fri, Jun 22, 2018 at 6:52 PM Darius Cooper <dariuscoo...@gmail.com> wrote: > Zoran, thanks for the great answer. > > > I got it working by implementing a proof-of-concept ExecutorServiceManager > and delegating all the methods that return either ExecutorService of > ScheduledExecutorService > > > Thinking about how this should look in production… > > > 1. get/set ThreadPoolFactory: I assume I can return null/ignore,,, won't > be used > > 2. Same for methods that use ThreadPoolProfile (assuming I will configure > in Liberty): I can ignore/return nulls > > 3. Then, there's the shutdown/graceful-shutdown methods. Would it make > more sense to try extending the DefaultExecutorServiceManager, and override > selectively? > > > > https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/DefaultExecutorServiceManager.java > > > > > > On Fri, May 4, 2018 at 3:52 AM Zoran Regvart <zo...@regvart.com> wrote: > >> Hi Darius, >> you need to implement ExecutorServiceManager[1] interface and delegate >> to ExecutorService you looked up in Liberty and set that >> implementation on CamelContext via setExecutorServiceManager[2] >> method. If you're using Camel Spring XML support and >> ExecutorServiceManager is available in the Spring application context >> it will be picked up automatically[3]. >> >> This does not happen if you're using Camel support for Spring Boot >> auto configuration. I've created CAMEL-12482[4] to make this on par in >> Spring Boot support. >> >> As a workaround you can invoke CamelContext::setExecutorServiceManager >> as a part of your initialization. Also make note that certain >> components use their own thread pools and will need additional >> configuration depending on the component. >> >> zoran >> >> On Fri, May 4, 2018 at 5:27 AM, Darius Cooper <dariuscoo...@gmail.com> >> wrote: >> > The Camel In Action book says: "When you need to use a different thread >> > pool provider (for example, a provider from a Java EE server), you can >> > create a custom ExecutorServiceManager to work with the provider. " >> > >> > >> > On IBM Liberty, by turning on the feature "concurrent/1.0" one can get >> an >> > ExecutorService. I would like to use this ExecutorService. >> > >> > My understanding is that I can create a ThreadPoolFacotory that wraps >> this >> > ExecutorService. >> > >> > As long as that ThreadPoolFactory is a Spring bean, Camel will find it >> and >> > use it as the default. >> > >> > Is that correct? It does not appear to use the ExecutorService from >> > Liberty. Does does it have to be set explicitly on the Camel context? >> >> [1] >> https://github.com/apache/camel/blob/03e57c355f5ddeb48af51e9e066dcfd60c2bd62f/camel-core/src/main/java/org/apache/camel/spi/ExecutorServiceManager.java >> [2] >> https://github.com/apache/camel/blob/03e57c355f5ddeb48af51e9e066dcfd60c2bd62f/camel-core/src/main/java/org/apache/camel/CamelContext.java#L1665 >> [3] >> https://github.com/apache/camel/blob/03e57c355f5ddeb48af51e9e066dcfd60c2bd62f/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java#L1183-L1187 >> [4] https://issues.apache.org/jira/browse/CAMEL-12482 >> -- >> Zoran Regvart >> >