Skip to content

no concurrency in spring-integration after upgrade of spring-boot from 2.4.9 to 2.5.3 #27623

@grmblfrz

Description

@grmblfrz

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.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions