-
Notifications
You must be signed in to change notification settings - Fork 645
Description
Igor Berman opened AMQP-411 and commented
There are different options to configure threads/thread factories/executors.
In addition there are differences when using spring-amqp as a producer and as a consumer. In my opinion the documentation is not clear enough. It's not clear how I can a) influence creation of threads b) which component uses what executor/factory(there are at least 4 such components) - consumers/connections threads(?)/connection executors(?)/heartbeat
1)I can provide thread factory to the rabbitmq connection factory
com.rabbitmq.client.ConnectionFactory lowLevelFactory = new com.rabbitmq.client.ConnectionFactory();
ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("Message producer thread %d").build();
lowLevelFactory.setThreadFactory(threadFactory);
return new CachingConnectionFactory(lowLevelFactory);
- I can set executor to the ampq connection factory
connectionFactory.setExecutor(daemonThreadsExecutor());
private Executor daemonThreadsExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setMaxPoolSize(1);
executor.setCorePoolSize(1);
executor.setDaemon(true);
executor.initialize();
return executor;
}
-
I haven't found the way to set heartbeat thread to be what I want. Might be You want to take it as a different feature request/improvement
-
When defining SimpleMessageListenerContainer I can set executor
container.setTaskExecutor(taskExecuter());
It's not clear what is the difference between 1 & 2 and when each one of them is used
For producer only 1 is relevant
For consumer(as message listener) probably all of them are relevant is some way.
Thanks in advance.
Anyway enjoying your product.
Affects: 1.3.5
Referenced from: pull request #228