Java 11 and Spring Integration 5.x here. I come from an Apache Camel background am trying to wire all of my channels together with whatever Spring Integration's equivalent of a SEDA Queue is. Currently I have all of my channels being defined with their own asynchronous task executor like so:
@Bean
public Executor channel1Executor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
executor.setThreadNamePrefix("c1-executor");
return executor;
}
@Bean
public Executor channel2Executor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
executor.setThreadNamePrefix("c2-executor");
return executor;
}
@Bean
public Executor channel3Executor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
executor.setThreadNamePrefix("c3-executor");
return executor;
}
@Bean
public MessageChannel channel1() {
return MessageChannels.executor("c1", channel1Executor()).get();
}
@Bean
public MessageChannel channel2() {
return MessageChannels.executor("c2", channel2Executor()).get();
}
@Bean
public MessageChannel channel3() {
return MessageChannels.executor("c3", channel3Executor()).get();
}
Is this the standard way of wiring together channels asynchronously, SEDA-like? Or should I be using one (1) single async executor for all channels (1, 2 and 3)?