After upgrade of spring-boot I noticed a problem in our spring integration flows. They did no loger process concurrently. Only after excluding IntegrationAutoConfiguration.class the problem went away. With spring-boot 2.4.9 and spring-integration 2.5.2 the problem did not occur, so I'm suspecting some change in IntegrationAutoConfiguration.class whicht triggers the problem. Sample code demonstrating the problem is in https://gist.github.com/grmblfrz/f0b2bc94527fb71c757f3b10e6780c81. This processes files (actually just sleeps for 10 seconds per file) from 2 directories (/tmp/in/a and /tmp/in/b). With spring-boot 2.4.9 the processing occurs concurrently:
2021-08-10 14:55:29.400 INFO 504961 --- [ask-scheduler-9] o.s.integration.handler.LoggingHandler : processing /tmp/in/b/1
2021-08-10 14:55:29.400 INFO 504961 --- [ask-scheduler-2] o.s.integration.handler.LoggingHandler : processing /tmp/in/a/1
with spring-boot 2.5.3 the processing is serialized:
2021-08-10 15:23:37.371 INFO 549888 --- [ scheduling-1] o.s.integration.handler.LoggingHandler : processing /tmp/in/a/1
2021-08-10 15:23:47.391 INFO 549888 --- [ scheduling-1] o.s.integration.handler.LoggingHandler : processing /tmp/in/b/1
The problem vanishes when I exclude IntegrationAutoConfiguration.class:
@SpringBootApplication(exclude = {IntegrationAutoConfiguration.class})
It also vanishes when using a task executor (see gist for newThreadPool):
@Bean
public IntegrationFlow flowA() {
return IntegrationFlows.from(Files.inboundAdapter(new File("/tmp/in/a")), e -> e.poller(p -> p.fixedDelay(100)
.taskExecutor(newThreadPool(1, "in_a"))
.transactional(new PseudoTransactionManager())
.transactionSynchronizationFactory(moveToDirFactory(Path.of("/tmp/out/a"))))).log(originalFilenameMsg)
.handle(IntegrationtestApplication::sleepHandler).log().channel("nullChannel").get();
}
Unfortunately I have no idea what is responsible for this change in behaviour.
Comment From: wilkinsona
Due to https://github.com/spring-projects/spring-boot/pull/25109, Spring Integration will use the auto-configured task scheduler by default which uses a single thread. You can configure the size of the pool using the spring.task.scheduling.pool.size
property.
It looks like we missed adding an entry to the release notes for this change. We can use this issue to do that.
Comment From: snicoll
I've added an additional section in the release notes for 2.5. Thanks for the report @grmblfrz