I've found a couple of things I don't understand when using the
camel-cdi component.
1. The @ContextName("customname") annotation can be used to specify a
custom name for the camel context. But I'm finding that this annotation
is essential.
e.g. if my app comprise just of a couple of classes extending
RoutBuilder then I MUST have this annotation present.
I would have assumed that if I only have a single CamelContext then this
would have been unnecessary?
2. I'm try to use a custom thread pool. As described in the docs I use a
@Producer to generate the thread pool profile:
public class CamelContextFactory {
@Produces
@ApplicationScoped
CamelContext customize() {
DefaultCamelContext context = new DefaultCamelContext();
context.setName("mycontext");
ThreadPoolProfile profile = new
ThreadPoolProfileBuilder("poolName").poolSize(4).maxPoolSize(50).build();
context.getExecutorServiceManager().registerThreadPoolProfile(profile);
return context;
}
}
This seems to be executed as expected, but when I try to use the thread
pool in a route like this:
from("direct:foo" )
.threads().executorServiceRef("poolName")
.log("route executed");
then the pool can't be found:
Caused by: java.lang.IllegalArgumentException: ExecutorServiceRef poolName not
found in registry or as a thread pool profile.
Thanks for any advice on these.
Tim